Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int selection, CEb, CRb, USDb, resultb;
- double CrForHundred, CE, CR, USD;
- double DOLLAR_PER_CE = 0.0025;
- double CE_PER_DOLLAR = 400;
- double temp, result;
- cout << fixed << setprecision(6);
- do {
- cout << "Input: \n\n1. CE \n2. CR \n3. Money" << endl;
- cout << "\nSelection: ";
- cin >> selection;
- cout << endl;
- switch (selection)
- {
- case 1:
- cout << "\n\n Input: CE (using rate of $50 per 20K CE)\n\n\n";
- cout << "Current price of 100CE, in CR: ";
- cin >> CrForHundred;
- cout << "Amount of CE to convert: ";
- cin >> CE;
- temp = CrForHundred / 100.0;
- result = temp * CE;
- CEb = CE;
- resultb = result;
- cout << "\n" << CEb << "CE is equivalent to " << resultb << "CR\n" << endl;
- result = CE * DOLLAR_PER_CE;
- cout << setprecision(2);
- cout << "\n" << CEb << "CE is equivalent to $" << result << "\n" << endl;
- cout << setprecision(6);
- DOLLAR_PER_CE = 0.0025;
- cout << "Press any key to return to the menu." << endl;
- getch();
- break;
- case 2:
- cout << "\n\n Input: CR (using rate of $50 per 20K CE)\n\n\n";
- cout << "Current price of 100CE, in CR: ";
- cin >> CrForHundred;
- cout << "Amount of CR to convert: ";
- cin >> CR;
- CRb = CR;
- temp = 100.0 / CrForHundred;
- result = temp * CR;
- resultb = result;
- cout << "\n" << CRb << "CR is equivalent to " << resultb << "CE\n" << endl;
- result = result * DOLLAR_PER_CE;
- cout << setprecision(2);
- cout << "\n" << CRb << "CR is equivalent to $" << result << "\n" << endl;
- cout << setprecision(6);
- DOLLAR_PER_CE = 0.0025;
- cout << "Press any key to return to the menu." << endl;
- getch();
- break;
- case 3:
- cout << "\n\n Input: USD (using rate of $50 per 20K CE)\n\n\n";
- cout << "Current price of 100CE, in CR: ";
- cin >> CrForHundred;
- temp = CrForHundred / 100.0;
- cout << "Amount of money to convert: $";
- cin >> USD;
- result = USD * CE_PER_DOLLAR;
- resultb = result;
- cout << setprecision(2);
- cout << "\n" << "$" << USD << " is equivalent to " << resultb << "CE\n" << endl;
- result = result * temp;
- resultb = result;
- cout << "\n" << "$" << USD << " is equivalent to " << resultb << "CR\n" << endl;
- cout << setprecision(6);
- DOLLAR_PER_CE = 0.0025;
- cout << "Press any key to return to the menu." << endl;
- getch();
- break;
- default:
- cout << "\nInvalid selection. Derp.\n" << endl;
- }
- }while(1);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement