Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- #include<vector>
- #include<algorithm>
- #include<cmath>
- using namespace std;
- inline void keep_window_open() { char ch; cin>>ch; }
- int main () {
- double chinese_rmb;
- double usa_dollar;
- double european_euro;
- int userinput;
- constexpr double rmb_to_usd=0.16;
- constexpr double rmb_to_euro=0.13;
- constexpr double usd_to_euro=0.85;
- cout<<"Welcome to my currency convertor.\n";
- cout<<"This convertor supports USD,RMB,and the EURO.\n";
- cout<<"If converting usd to rmb press 1\n";
- cout<<"If converting rmb to usd press 2\n";
- cout<<"If converting usd to euro press 3\n";
- cout<<"If converting euro to usd press 4\n";
- cout<<"If converting rmb to euro press 5\n";
- cout<<"If converting euro to rmb press 6\n";
- cin>>userinput;
- switch (userinput) {
- case 1: cout<<"Enter in the amount of USD you wish to convert\n";
- cin>>usa_dollar;
- cout<<"You now have ";
- cout<<usa_dollar/rmb_to_usd;
- cout<<" Chinese RMB";
- break;
- case 2: cout<<"Enter in the amount of RMB you wish to convert\n";
- cin>>chinese_rmb;
- cout<<"You now have ";
- cout<<chinese_rmb*rmb_to_usd;
- cout<<" American USD";
- break;
- case 3:
- cout<<"Enter in the amount of USD you want to convert\n";
- cin>>usa_dollar;
- cout<<"You now have "<<usa_dollar*usd_to_euro<< " European EURO";
- break;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement