Petro_zzz

311_1402

Feb 14th, 2024
1,187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.43 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void show_menu();
  6. void converter_rub2usd();
  7. void converter_usd2rub();
  8.  
  9. void children() {
  10.     int k = 0;
  11.     //cout << "Enter ";
  12.     //cin >> k;
  13.     while(k < 10) {
  14.         cout << k << " ";
  15.         k++;
  16.     }
  17.     cout << endl;
  18. }
  19.  
  20. void bill() {
  21.     int summ = 0;
  22.     int price;
  23.     int n = 0;
  24.    
  25.     while (n < 4) {
  26.         cout << "Enter " << n << " product ";
  27.         cin >> price;
  28.         summ += price;
  29.         n++;
  30.     }
  31.     cout << "TOTAL: " << summ << endl;
  32. }
  33.  
  34. const double price_usd_rub = 91.51;
  35.  
  36. void converter_rub2usd() {
  37.     double rub, usd;
  38.     cout << "Enter numbers of rub for covert to usd: ";
  39.     cin >> rub;
  40.  
  41.     usd = rub / price_usd_rub;
  42.     cout << "You can take " << usd << " usd" << endl;
  43. }
  44.  
  45. void converter_usd2rub() {
  46.     double rub, usd;
  47.     cout << "Enter numbers of usd for covert to rub: ";
  48.     cin >> usd;
  49.  
  50.     rub = usd * price_usd_rub;
  51.     cout << "You can take " << rub << " rub" << endl;
  52. }
  53.  
  54. void show_menu() {
  55.     cout << endl;
  56.     cout << "     Converter Money    " << endl;
  57.     cout << endl;
  58.        
  59.     cout << " 1. Convert rub to usd." << endl;
  60.     cout << " 2. Convert usd to rub." << endl;
  61.     cout << " 0. Exit." << endl;
  62.     int mode = 1;
  63.     while (mode > 0) {
  64.         cin >> mode;
  65.         if (mode == 1) {
  66.             converter_rub2usd();
  67.         }
  68.         if (mode == 2) {
  69.             converter_usd2rub();
  70.         }
  71.         cout << "Enter 0 for exit" << endl;
  72.     }
  73.     cout << endl;
  74. }
  75.  
  76. int main() {
  77.     //children();
  78.     //bill();
  79.     //converter_money();
  80.     show_menu();
  81.     system("pause");
  82.     return 0;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment