Hey guys! So I have an assignment which requires me to make a program that will determine the buying and selling value of USD and Mexican Peso. The program is to run the entire day and at the end it will have to be terminated using a special sentinel. The idea is that since this is a business we will have to make a profit so that is how the calculate is set up. The program is not complete though but I am facing major problems. If anyone wants the actual assignment sheet only then I will post it as I am not sure whether it is allowed to post it or not. I can PM it too. Thanks.
Code:
#include <iostream>
#include <cmath>
using namespace std;
double setRate(double rate);
double rate = 13.30;
enum exType { BUY, SELL };
int exchn;
int main()
{
double exchange(double rate, exType ex);
void showRates(double rate);
int showMenu(double rate);
void buyPesos();
void sellPesos();
double amount;
{
cout << " CURRENCY EXCHANGE MEXICAN PESOS<>USD\n";
cout << "\n--------------------------------------------------\n";
cout << " Buying Pesos" << " " << " Selling Pesos\n";
cout << "\n";
cout << "$1 = 12.3690 MXN" << " " << "14.2310 MXN\n";
cout << "\nSelect the option\n" << endl
<< "1. Pesos to Dollars" << endl
<< "2. Dollars to Pesos" << endl
<< "3. Change Exchange Rate" << endl
<< "4. Show Exchange Rate" << endl
<< "5. Exit" << endl;
system("pause");
}
{
enum exchange { SellPesos = 1, BuyPesos, ChangeRate, ShowRate, Exit };
while (exchn == 1 || exchn == 2 || exchn == 3 || exchn == 4 || exchn <= 0 || exchn >= 6)
{
int showMenu(double rate);
cin >> exchn;
cout << endl;
}
switch (exchn)
{
case SellPesos:
cout << "Enter the amount to convert to Dollars: ";
/*one rate for changing the foreign currency to the $US*/
cin >> amount;
cout << endl;
cout << "You will get " << amount / (rate*0.93) << " USD" << endl;
break;
case BuyPesos:
{
cout << "Enter the amount to exchange in Pesos: "; //one rate for changing from $US to the foreign currency
cin >> amount;
cout << endl;
cout << "You will get " << amount*(rate*1.07) << " Pesos" << endl;
break;
}
case Exit:
{
cout << "Exiting" << endl << endl;
break;
}
cout << " INVALID " << endl;
system("pause");
return 0;
}
}
}
Comment