Advertisement
Guest User

Untitled

a guest
Mar 5th, 2016
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6.     double eur_rur = 79.06;
  7.     double usd_rur = 71.86;
  8.     double gbp_rur = 102.30;
  9.     double currency = 0;
  10.     char unit = ' ';
  11.  
  12.     std::cout << "Please enter the number of roubles you have: " << std::endl;
  13.     std::cin >> currency;
  14.     std::cout << "Please enter the currency you want to convert you money ('e' - Euro, 'd' - Dollar, 'g' - Great Britan Pounds): " << std::endl;
  15.     std::cin >> unit;
  16.  
  17.     if (unit == 'e')
  18.     {
  19.         std::cout << currency << " roubles = " << currency / eur_rur << " Euro." << std::endl;
  20.     }
  21.     else if (unit == 'd')
  22.     {
  23.         std::cout << currency << " roubles = " << currency / usd_rur << " Dollars." << std::endl;
  24.     }
  25.     else if (unit == 'g')
  26.     {
  27.         std::cout << currency << " roubles = " << currency / gbp_rur << " Great Britan Pounds." << std::endl;
  28.     }
  29.     else
  30.     {
  31.         std::cout << "Sorry, i do not understand what you input." << std::endl;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement