Advertisement
Guest User

Untitled

a guest
Sep 8th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <iomanip>
  4. using namespace std;
  5. int main()
  6. {
  7.     int selection, CEb, CRb, USDb, resultb;
  8.     double CrForHundred, CE, CR, USD;
  9.     double DOLLAR_PER_CE = 0.0025;
  10.     double CE_PER_DOLLAR = 400;
  11.     double temp, result;
  12.     cout << fixed << setprecision(6);
  13.     do {
  14.     cout << "Input: \n\n1. CE \n2. CR \n3. Money" << endl;
  15.     cout << "\nSelection: ";
  16.     cin >> selection;
  17.     cout << endl;
  18.     switch (selection)
  19.     {
  20.            case 1:
  21.                 cout << "\n\n Input: CE (using rate of $50 per 20K CE)\n\n\n";
  22.                 cout << "Current price of 100CE, in CR: ";
  23.                 cin >> CrForHundred;
  24.                 cout << "Amount of CE to convert: ";
  25.                 cin >> CE;
  26.                 temp = CrForHundred / 100.0;
  27.                 result = temp * CE;
  28.                 CEb = CE;
  29.                 resultb = result;
  30.                 cout << "\n" << CEb << "CE is equivalent to " << resultb << "CR\n" << endl;
  31.                 result = CE * DOLLAR_PER_CE;
  32.                 cout << setprecision(2);
  33.                 cout << "\n" << CEb << "CE is equivalent to $" << result << "\n" << endl;
  34.                 cout << setprecision(6);
  35.                 DOLLAR_PER_CE = 0.0025;
  36.                 cout << "Press any key to return to the menu." << endl;
  37.                 getch();
  38.                 break;
  39.            case 2:
  40.                 cout << "\n\n Input: CR (using rate of $50 per 20K CE)\n\n\n";
  41.                 cout << "Current price of 100CE, in CR: ";
  42.                 cin >> CrForHundred;
  43.                 cout << "Amount of CR to convert: ";
  44.                 cin >> CR;
  45.                 CRb = CR;
  46.                 temp = 100.0 / CrForHundred;
  47.                 result = temp * CR;
  48.                 resultb = result;
  49.                 cout << "\n" << CRb << "CR is equivalent to " << resultb << "CE\n" << endl;
  50.                 result = result * DOLLAR_PER_CE;
  51.                 cout << setprecision(2);
  52.                 cout << "\n" << CRb << "CR is equivalent to $" << result << "\n" << endl;
  53.                 cout << setprecision(6);
  54.                 DOLLAR_PER_CE = 0.0025;
  55.                 cout << "Press any key to return to the menu." << endl;
  56.                 getch();
  57.                 break;
  58.            case 3:
  59.                 cout << "\n\n Input: USD (using rate of $50 per 20K CE)\n\n\n";
  60.                 cout << "Current price of 100CE, in CR: ";
  61.                 cin >> CrForHundred;
  62.                 temp = CrForHundred / 100.0;
  63.                 cout << "Amount of money to convert: $";
  64.                 cin >> USD;
  65.                 result = USD * CE_PER_DOLLAR;
  66.                 resultb = result;
  67.                 cout << setprecision(2);
  68.                 cout << "\n" << "$" << USD << " is equivalent to " << resultb << "CE\n" << endl;
  69.                 result = result * temp;
  70.                 resultb = result;
  71.                 cout << "\n" << "$" << USD << " is equivalent to " << resultb << "CR\n" << endl;
  72.                 cout << setprecision(6);
  73.                 DOLLAR_PER_CE = 0.0025;
  74.                 cout << "Press any key to return to the menu." << endl;
  75.                 getch();
  76.                 break;
  77.            default:
  78.                    cout << "\nInvalid selection. Derp.\n" << endl;
  79.                    }
  80.                    }while(1);
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement