Advertisement
StoneHaos

Untitled

Jun 16th, 2020
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.08 KB | None | 0 0
  1. #include <iostream>
  2. //#include <windows.h>
  3. #include <locale.h>
  4. #include <iomanip>
  5.  
  6. using namespace std;
  7.  
  8. struct group
  9. {
  10.     char name[64];
  11.     char surname[64];
  12.     char patronymic[64];
  13.     int phycu;
  14.     int mat;
  15.     int inf;
  16.     int phy;
  17. };
  18. void showData(const group q[], int amount);
  19. int main()
  20. {
  21.  
  22.     setlocale(LC_ALL, "Russian");
  23.     const int amount = 3;
  24.     int n = amount;
  25.     group Students[amount] = {};
  26.     for (int i = 0; i < amount; i++)
  27.     {
  28.  
  29.         cout << "Фамилия: ";
  30.         cin >>Students[i].surname;
  31.         cout << "Имя: ";
  32.         cin >> Students[i].name;
  33.         cout << "Отчество: ";
  34.         cin >> Students[i].patronymic;
  35.         cout << "Математика: ";
  36.         cin >> Students[i].mat;
  37.         cout << "Информатика: ";
  38.         cin >> Students[i].inf;
  39.         cout << "Физика: ";
  40.         cin >> Students[i].phy;
  41.         cout << "Физическая культура (зачет 1/незачет 2): ";
  42.         cin >> Students[i].phycu;
  43.         cout << endl;
  44.         cout << endl;
  45.     }
  46.  
  47.     for (int i = 0; i < n; ++ i) {
  48.         if (Students[i].mat <= 2 || Students[i].inf <= 2 || Students[i].phy <= 2 || Students[i].phycu == 2) {
  49.             for (int j = i + 1; j < n; ++ j) {
  50.                 Students[j - 1] = Students[j];
  51.             }
  52.             -- n;
  53.             -- i;
  54.         }
  55.     }
  56.  
  57.     showData(Students, n);
  58.  
  59.     return 0;
  60. }
  61. void showData(const group q[], int amount)
  62. {
  63.     system("clear");
  64.         cout << "#  "
  65.             << setw( 15 ) << left << "Фамилия"
  66.             << setw( 11) << "Имя"
  67.             << setw( 16) << "Отчество" 
  68.             << setw( 18) << "Математика" 
  69.             << setw( 19) << "Информатика"   
  70.             << setw( 13) << "Физика"
  71.             << setw( 3 ) << "Ф/к"
  72.             << endl;
  73.         cout << "-----------------------------------------------------------------------------------------------------------" << endl;
  74.         int y = 1;
  75.         for (int i = 0; i < amount; i++)
  76.         {
  77.         cout << y++  << ") "
  78.             << setw(15) << left << q[i].surname
  79.             << setw(11) << q[i].name
  80.             << setw(21) << q[i].patronymic
  81.             << setw(18) << q[i].mat
  82.             << setw(17) << q[i].inf
  83.             << setw(10) << q[i].phy
  84.             << setw(19) << q[i].phycu
  85.             << endl;
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement