Advertisement
SteelK

Untitled

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