I have a simple code but a lot of the couts say they are ambiguous. Any help is appreciated, I don't know what is causing this. I am running this on Microsoft Visual Studio 2013.
#include <iostream>
usingnamespace std;
int main()
{
//declaring variables
double usDollar = 1;
double canDollar = .9813;
double euro = .757;
double indRup = 52.53;
double japYen = 80.92;
double mexPeso = 13.1544;
double britPound = .6178;
int option;
char currency;
double userInput;
system("color 81");
do
{
cout << "1. Convert your currency to US Dollars." << endl;
cout << "2. Convert US Dollars to other currency.\n" << endl;
while ((cout << "Please enter the number of the task you would like to perform: \n")) && !((cin >> option))
{
cout << "Thats not a number\n\n";
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
}
if (option == 1)
{
cout << "(C) = Canadian Dollar" << endl;
cout << "(E) = Euro " << endl;
cout << "(I) = Indian Rupee" << endl;
cout << "(J) = Japanese Yen" << endl;
cout << "(M) = Mexican Peso" << endl;
cout << "(B) = British Pound" << endl;
cout << "\nPlease type the letter that corresponds with the currency you \nwant to exchange:" << "\n";
cin >> currency;
switch (toupper(currency))
{
case'C':
cout << "Please ener the amount of Canadian Dollars you would like to exchange:" << endl;
cin >> userInput;
cout << "\nYou now have " << userInput / canDollar << " US Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'E':
cout << "Please enter the amount of Euros you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput / euro << " US Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'I':
cout << "Please enter the amount of Indian Rupees you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput / indRup << " US Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'J':
cout << "Please enter the amount of Japanese Yen you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput / japYen << " US Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'M':
cout << "Please enter the amount of Mexican Pesos you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput / mexPeso << " US Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'B':
cout << "Please enter the amount of British Pounds you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput / britPound << " US Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
default: system("color 4f");
cout << "\nInvalid Data" << endl;
system("color 81");
}
}
if (option == 2)
{
cout << "(C) = Canadian Dollar" << endl;
cout << "(E) = Euro " << endl;
cout << "(I) = Indian Rupee" << endl;
cout << "(J) = Japanese Yen" << endl;
cout << "(M) = Mexican Peso" << endl;
cout << "(B) = British Pound" << endl;
cout << "\n\nPlease type the letter that corresponds with the currency you wish to \nexchange to:" << endl;
cin >> currency;
switch (toupper(currency))
{
case'C':
cout << "Please ener the amount of U.S. Dollars you would like to exchange:" << endl;
cin >> userInput;
cout << "You now have " << userInput * canDollar << " Canadian Dollars." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'E': cout << "Please enter the amount of U.S. Dollars you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput * euro << " Euros." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'I': cout << "Please enter the amount of U.S. Dollars you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput * indRup << " Indian Rupees." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'J': cout << "Please enter the amount of U.S. Dollars you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput * japYen << " Japanese Yen." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'M': cout << "Please enter the amount of U.S. Dollars you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput * mexPeso << " Mexican Pesos." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
case'B': cout << "Please enter the amount of U.S. Dollars you would like to exchange: " << endl;
cin >> userInput;
cout << "You now have " << userInput * britPound << " British Pounds." << endl;
cout << "--------------------------------------------------------------" << endl;
break;
default: system("color 4f");
cout << "\nInvalid Data" << endl;
system("color 81");
}
}
elseif (option < 1 || option > 2)
{
cout << "Invalid data " << endl;
cout << "------------------------------------------------------------------" << endl;
}
} while (option < 1 || option > 2);
system("pause");
return 0;
}