I am doing a program that is to expand the "Currency Conversion" program to accept a currency amount for one currency from the user, which is error checked as a valid entry, and then display its equivalency in US dollars. Insert comments in the program to document the program internally. Be sure not to over design the program, in particular include requirements to be added to the program in the subsequent weeks. The thing is when I do this from what i've wrote then it gives me a bad input error at the line to enter today's exchange rate. I know that it should be a string and not long but i'm not really sure how to change that. Can anyone tell this woman who's been up for 72 hours straight trying to figure it out where the heck the snake is that should've already bitten her? Any help is greatly appreciated!!
#include <iostream.h>
#include <string>
using namespace std;
int main ()
{
//enter input items
long currency = 0.0;
cout << "Enter Currency: ";
cin >> currency;
switch (currency)
{
case 'Euro':
case 'euro': cout << "Euro" << endl;
break;
case 'FF':
case 'ff': cout << "FF" << endl;
break;
case 'DM':
case 'dm': cout << "DM" << endl;
break;
case 'GBP':
case 'gbp': cout << "GBP" << endl;
break;
case 'Yen':
case 'yen': cout << "Yen" << endl;
break;
} //end switch
cout << "Enter Today's Exchange Rate:";
cin. >> currency;
if (cin.fail())
{ cout << "Error: bad input";
return 1;
}//validation of input
float rate = 0.0;
bool more = true;
cout << "Enter USD amount:"<<"\n";
while (more)
{
float usDollar = 0.0;
if (cin >> usDollar)
{
if (usDollar <= 0)//test for sentinel
more = false;
else
{
currency = usDollar * (cin, currency);
cout << currency << "";
}
}
}
return 0;
} //end of main function