Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Money Converter
- 2 #include <iostream>
- 3 using namespace std;
- 4 int main()
- 5 {
- 6 const double euros_per_dollar = 0.95 , yens_per_dollar = 121.34;
- 7
- 8 double dollars = 0;
- 9
- 10 //char unit = '\0';
- 11 cout << "Please enter the amount of dollars you wish to convert: \n";
- 12 cin >> dollars;
- 13
- 14 string yens;
- 15 string euros;
- 16 cout << "Do you wish to convert yens or euros? \n";
- 17 string input;
- 18 cin >> input;
- 19 cout << "You entered: "<< input << '\n';
- 20 if(input == yens)
- 21 {
- 22 cout << "The amount of yens you have is: " << dollars*yens_per_dollar << '\n';
- 23 }
- 24
- 25 if(input != yens)
- 26 {
- 27 cout << "The amount of euros you have is: " << dollars*euros_per_dollar << '\n';
- 28 }
- 29
- 30
- 31 return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement