//SZ
//Currency Exchange Program
#include
using namespace std;
/*
1 Euro = 112 Rupees.
1 Dollar = 84 Rupees.
1 Euro = 1.33 Dollars
1 Dollar = 0.75 EUR*/
int main()
{
char myCur, convCur;
double myRupees(0), myEuros(0), myDollars(0);
double convertedAmount(0);
bool flag = false;
while(flag == false)
{
cout << "Welcome to the Currency Exchange Rate Program!" << endl << endl << endl;
cout << "Key Description\n" << endl;
cout << "R Pakistani Rupees" << endl;
cout << "E European Euro" << endl;
cout << "D American Dollar" << endl << endl;
while( myCur != 'R' && myCur != 'E' && myCur != 'D')
{
cout << "Please select the key for the currency you have: ";
cin >> myCur;
myCur = toupper(myCur);
if(myCur == 'R' )
{
cout << "Please enter the amount of Rupees you have: ";
cin >> myRupees;
}
else if(myCur == 'E')
{
cout << " Please enter the amount of Euros you have: ";
cin >> myEuros;
}
else if(myCur == 'D')
{
cout << "Please enter the amount of Dollars you have: ";
cin >> myDollars;
}
else
{
cout << "Please enter a valid key" << endl;
}
}
do{
cout << "Please select the key for the currency you want to convert to: ";
cin >> convCur;
convCur = toupper(convCur);
}while(myCur == convCur);
if (myCur == 'R' && convCur == 'E')
{
// 1 Euro = 112 Rupees.
convertedAmount = myRupees / 112;
}
if (myCur == 'R' && convCur == 'D')
{
//1 Dollar = 84 Rupees.
convertedAmount = myRupees / 84;
}
if (myCur == 'E' && convCur == 'R')
{
// 1 Euro = 112 Rupees.
convertedAmount = myEuros * 112;
}
if (myCur == 'E' && convCur == 'D')
{
// 1 Euro = 1.33 Dollars
convertedAmount = myEuros * 1.33;
}
if (myCur == 'D' && convCur == 'R')
{
//1 Dollar = 84 Rupees.
convertedAmount = myDollars * 84;
}
if(myCur == 'D' && convCur == 'E')
{
// 1 Euro = 1.33 Dollars
convertedAmount = myDollars / 1.33;
}
if(myCur == 'R')
{
cout << myRupees << " Rupees converted into ";
}
if(myCur == 'E')
{
cout << myEuros << " Euros converted into ";
}
if(myCur == 'D')
{
cout << myDollars << " Dollars converted into ";
}
if( convCur == 'R')
{
cout << convertedAmount << " Rupees" << endl;
}
if(convCur == 'E')
{
cout << convertedAmount << " Euros" << endl;
}
if(convCur == 'D')
{
cout << convertedAmount << " Dollars" << endl;
}
char answer;
cout << "\nWould you like to run another conversion? (y/n)" << endl;
cin >> answer;
answer = tolower(answer);
if (answer == 'n')
{
flag = true;
}
system("CLS");
myCur = '\0';
}
system("Pause");
return 0;
}
NOTE: - These Assignments OR Quiz are just for idea, so kindly don't copy it, after viewing it make your own. Thanks
We always try our best to upload 100% correct solution BUT it is requested that you kindly review it before submission, please BEST OF LUCK,
Thanks to those students those send me Assignments and quizzes. If you have any Assignment and quiz kindly send at jamilbookcenter@yahoo.com
No comments:
Post a Comment