Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main() {   
  9.     double levove = 1;
  10.     double dolari = 1.79549;
  11.     double evro = 1.95583;
  12.     double payndove = 2.53405;
  13.  
  14.     string BGN = "BGN";
  15.     string USD = "USD";
  16.     string EUR = "EUR";
  17.     string GBP = "GBP";
  18.  
  19.     string input_money;
  20.     string new_currency;
  21.  
  22.     double ammount;
  23.     cin >> ammount;
  24.     cin >> input_money;
  25.  
  26.  
  27.     if (input_money == BGN) {
  28.         ammount = ammount * levove;
  29.     }
  30.     else if (input_money == USD) {
  31.         ammount = ammount * dolari;
  32.     }
  33.     else if (input_money == EUR) {
  34.         ammount = ammount * evro;
  35.     }
  36.     else if (input_money == GBP) {
  37.         ammount = ammount * payndove;
  38.     }
  39.  
  40.  
  41.     cin >> new_currency;
  42.     if (new_currency == BGN) {
  43.         ammount = ammount / levove;    
  44.     }
  45.     else if (new_currency == USD) {
  46.         ammount = ammount / dolari;    
  47.     }
  48.     else if (new_currency == EUR) {
  49.         ammount = ammount / evro;      
  50.     }
  51.     else if (new_currency == GBP) {
  52.         ammount = ammount / payndove;
  53.        
  54.     }
  55.  
  56.     printf_s("%.2f", ammount);
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement