Advertisement
SteelK

Untitled

Jun 5th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cstdlib>
  4.  
  5. using namespace std;
  6.  
  7. typedef char word;
  8. typedef char* sword;
  9.  
  10. sword outword(int in_number, sword in_Im_ed, sword in_Rod_ed, sword in_Rod_mn)
  11. {
  12.     int goabs = (in_number);
  13.     int if100 = goabs % 100;
  14.     int snumber = goabs % 10;
  15.  
  16.     switch (snumber)
  17.     {
  18.     case 0:
  19.         return in_Rod_mn;
  20.  
  21.     case 1:
  22.     {
  23.         if (if100 == 11)
  24.             return in_Rod_mn;
  25.         return in_Im_ed;
  26.     }
  27.  
  28.     case 2:
  29.     case 3:
  30.     case 4:
  31.     {
  32.         if ((if100 >= 12) && (if100 <= 14))
  33.             return in_Rod_mn;
  34.         return in_Rod_ed;
  35.     }
  36.  
  37.     case 5:
  38.     case 6:
  39.     case 7:
  40.     case 8:
  41.     case 9:
  42.         return in_Rod_mn;
  43.     }
  44. }
  45.  
  46. int main() {
  47.     double volime_grad = rand() % 90 + 1;
  48.     double abc = 180 - 2 * volime_grad;
  49.  
  50.     int select = rand() % 4;
  51.  
  52.     word danoe[3];
  53.     word seach[3];
  54.  
  55.     switch (select)
  56.     {
  57.     case 0:
  58.         strcpy(danoe, "BAC");
  59.         break;
  60.  
  61.     case 1:
  62.         strcpy(danoe, "DAC");
  63.         break;
  64.  
  65.     case 2:
  66.         strcpy(danoe, "BCA");
  67.         break;
  68.  
  69.     case 3:
  70.         strcpy(danoe, "ACD");
  71.         break;
  72.     }
  73.  
  74.     select = rand() % 2;
  75.  
  76.     switch (select)
  77.     {
  78.     case 0:
  79.         strcpy(seach, "ABC");
  80.         break;
  81.  
  82.     case 1:
  83.         strcpy(seach, "ADC");
  84.         break;
  85.     }
  86.  
  87.     cout << "Задание:" << endl;
  88.     cout << "В ромбе ABCD угол " << danoe << " равен " << volime_grad << " " << outword(volime_grad, "градус", "градуса", "градусов") << ". Найдите угол " << seach << "." << endl;
  89.     cout << "Ответ дайте в градусах." << endl;
  90.     cout << "Ответ:" << endl;
  91.     cout << abc << endl;
  92.  
  93.     return 0;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement