Advertisement
Guest User

currency convertor.cxx

a guest
Jun 15th, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include<vector>
  4. #include<algorithm>
  5. #include<cmath>
  6. using namespace std;
  7. inline void keep_window_open() { char ch; cin>>ch; }
  8. int main () {
  9. double chinese_rmb;
  10. double usa_dollar;
  11. double european_euro;
  12. int userinput;
  13. constexpr double rmb_to_usd=0.16;
  14. constexpr double rmb_to_euro=0.13;
  15. constexpr double usd_to_euro=0.85;
  16. cout<<"Welcome to my currency convertor.\n";
  17. cout<<"This convertor supports USD,RMB,and the EURO.\n";
  18. cout<<"If converting usd to rmb press 1\n";
  19. cout<<"If converting rmb to usd press 2\n";
  20. cout<<"If converting usd to euro press 3\n";
  21. cout<<"If converting euro to usd press 4\n";
  22. cout<<"If converting rmb to euro press 5\n";
  23. cout<<"If converting euro to rmb press 6\n";
  24. cin>>userinput;
  25. switch (userinput) {
  26. case 1: cout<<"Enter in the amount of USD you wish to convert\n";
  27. cin>>usa_dollar;
  28. cout<<"You now have ";
  29. cout<<usa_dollar/rmb_to_usd;
  30. cout<<" Chinese RMB";      
  31. break;
  32. case 2: cout<<"Enter in the amount of RMB you wish to convert\n";
  33. cin>>chinese_rmb;
  34. cout<<"You now have ";
  35. cout<<chinese_rmb*rmb_to_usd;
  36. cout<<" American USD";
  37. break;
  38. case 3:
  39. cout<<"Enter in the amount of USD you want to convert\n";
  40. cin>>usa_dollar;
  41. cout<<"You now have "<<usa_dollar*usd_to_euro<< " European EURO";
  42. break;}
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement