Advertisement
SteelK

Untitled

Jun 15th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. typedef sword word;
  8. typedef word* sword;
  9.  
  10. sword outword(int in_number, sword in_Im_ed, sword in_Rod_ed, sword in_Rod_mn)
  11. {
  12.     int if100 = in_number % 100;
  13.     int snumber = in_number % 10;
  14.  
  15.     switch (snumber)
  16.     {
  17.     case 0:
  18.         return in_Rod_mn;
  19.  
  20.     case 1:
  21.     {
  22.         if (if100 == 11)
  23.             return in_Rod_mn;
  24.         return in_Im_ed;
  25.     }
  26.  
  27.     case 2:
  28.     case 3:
  29.     case 4:
  30.     {
  31.         if ((if100 >= 12) && (if100 <= 14))
  32.             return in_Rod_mn;
  33.         return in_Rod_ed;
  34.     }
  35.  
  36.     case 5:
  37.     case 6:
  38.     case 7:
  39.     case 8:
  40.     case 9:
  41.         return in_Rod_mn;
  42.     }
  43. }
  44.  
  45.  
  46. int main()
  47. {
  48.     setlocale(0, "");
  49.     srand(time(NULL));
  50.    
  51.     sword wordUgl[] = {"больше", "меньше"};
  52.     sword wordSearh[] = {"больший", "меньший"};
  53.    
  54.     int selectRand1 = rand() % 2;
  55.     int selectRand2 = rand() % 2;
  56.     int ugol = rand() % 180 + 1;
  57.     int raznost = 180 - ugol;
  58.    
  59.     cout << "Задание:" << endl;
  60.     cout << "Один угол параллелограмма " <<  wordUgl[selectRand1] << " другого на "<< raznost <<" " << outword(raznost, "градус", "градуса", "градусов");
  61.     cout << " Найдите " << wordSearh[selectRand2] << " угол. Ответ дайте в градусах" << endl;
  62.     cout << "Ответ:" << endl;
  63.     if ((selectRand2 == 0 && ugol >= 89) || (selectRand2 == 1 && ugol <= 89))
  64.         cout << ugol << endl;
  65.     if ((selectRand2 == 1 && ugol >= 89) || (selectRand2 == 0 && ugol <= 89))
  66.         cout << raznost << endl;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement