fork download
  1. // Kevin Comer CS 101_25698
  2. // Currency
  3. // This purpose of this program is to convert US dollars to Euros and the
  4. // Philippine Peso.
  5.  
  6. #include <iostream>
  7. #include <iomanip>
  8.  
  9. using namespace std;
  10.  
  11. int main()
  12. {
  13. // First, I define my variables. I'll need variables for the following
  14. // figures: (1) USdollar, (2) PESO_PER_DOLLAR and (3) EUROS_PER_DOLLAR
  15. // I'll need to initialize both Pesos and Euros so the program can
  16. // multiply both by the dollar amount the user inputs.
  17.  
  18. double dollar;
  19. double PESO_PER_DOLLAR = 49.39 * dollar;
  20. double EUROS_PER_DOLLAR = 00.87 * dollar;
  21.  
  22. // Now that I've definied the three variables I'll need for the program
  23. // to compute the conversion, I'll enable the user to input the dollar
  24. // amount.
  25. // I use "showpoint" to ensure decimals are included in my total, while
  26. // "Setprecision(2)" sets my decimal point total to 2. I also want
  27. // to ensure all figures appear in fixed notation, and not scientific
  28. // notation, so I use the precision manipulator "fixed."
  29.  
  30. cout << "Please enter the amount of US currency to convert: $";
  31. cout << fixed << showpoint << setprecision(2);
  32. cin >> dollar;
  33. cout << endl;
  34.  
  35.  
  36. // Now the program computes the amount, which it then displays.
  37.  
  38. cout << "The value of " << dollar << " US dollars is equivalent to ";
  39. cout << PESO_PER_DOLLAR << " Philippine Peso and ";
  40. cout << EUROS_PER_DOLLAR << " Euros." << endl;
  41.  
  42. system("pause");
  43.  
  44. return 0;
  45. }
Success #stdin #stdout #stderr 0s 4348KB
stdin
Standard input is empty
stdout
Please enter the amount of US currency to convert: $
The value of 0.00 US dollars is equivalent to 0.00 Philippine Peso and 0.00 Euros.
stderr
sh: 1: pause: not found