Advertisement
alexdmin

7.2

Apr 12th, 2021
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. const int size = 20;
  5.  
  6. struct study
  7. {
  8.     char name[20];
  9.     int raiting_math;
  10.     int raiting_phys;
  11.     int raiting_prog;
  12.  
  13. };
  14. using namespace std;
  15. int main()
  16. {
  17.     const int size = 20;
  18.     setlocale(LC_ALL, "rus");
  19.     int n = 0;
  20.     cout << "1 - мат. анализ\n2 - физика\n3 - программирование\n";
  21.     cin >> n;
  22.     int amount;
  23.     cout << "amount = ";
  24.     cin >> amount;
  25.     cout << "\n";
  26.     study* p_study = new study[amount];
  27.    
  28.     p_study[1] = { "Alexey", 6, 5, 7 };
  29.     if (n > 1)
  30.     {
  31.         p_study[2] = { "Pavel", 5, 3, 7 };
  32.     }
  33.     if (n > 2)
  34.     {
  35.         p_study[3] = { "Ilya", 2, 6, 8 };
  36.     }
  37.     if (n > 3)
  38.     {
  39.         p_study[4] = { "Arthur", 7, 5, 9 };
  40.     }
  41.     if (n > 4)
  42.     {
  43.         p_study[5] = { "Lehan", 2, 3, 3 };
  44.     }
  45.    
  46.  
  47.  
  48.  
  49.     cout << "\nНеуспевающие студенты:\n";
  50.     for (int i = 1; i < amount; i++)
  51.     {
  52.  
  53.         if (n == 1)
  54.         {
  55.             if (p_study[i].raiting_math < 4)
  56.             {
  57.                 cout << p_study[i].name << endl;
  58.             }
  59.         }
  60.         if (n == 2)
  61.         {
  62.             if (p_study[i].raiting_phys < 4)
  63.             {
  64.                 cout << p_study[i].name << endl;
  65.             }
  66.         }
  67.         if (n == 3)
  68.         {
  69.             if (p_study[i].raiting_prog < 4)
  70.             {
  71.                 cout << p_study[i].name << endl;
  72.             }
  73.         }
  74.  
  75.     }
  76.     delete[]p_study;
  77.  
  78.     return 0;
  79. }
  80.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement