0

THis is a exhange calculator and it doesn't work.It asks me to input from value and than it just starts without asking me for the other variables.The program should take user input and than calculate.For example it asks me from i input dollar and than I input to euro and than I input the amount and than ti should display output

#include <iostream>

using namespace std;


int main()
{

    double v_nr[10] = { 4.12, 5.54, 3.41, 6,98 };
    double interest = 2,to_v,from_v;

    char name[10][10] = { "dollar", "euro", "dollar2", "euro2" };
    cout<<"Welcome to converter... \n";
    for(;;)
    {
        cout<<"Convert from:";
        char from[256];
        cin.get(from,255);
        for(int i = 0;i<=10;i++)
        {
            if(from==name[i]) 
            {
                 from_v = v_nr[i];
                break;
            }
        }       
        cout<<"to: ";
        char to[256];
        cin.get(to,256);
        for(int i = 0;i<=10;i++)
        {
            if(to==name[i])
            {
                 to_v = v_nr[i];
                break;
            } 
        }
        double amount;
        cout<<"How many: ";
        cin>>amount;
        cout<<"You get"<<(amount*from_v)/to_v;

        cout<<"PRESS q to quit(press anything else to try again)";

    }

   
}

    

0 Answers0