Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- #define SIZE 4
- using namespace std;
- struct node
- {
- string group;
- string surname;
- short subjects[5];
- };
- int main()
- {
- node table[SIZE];
- for (int i = 0; i < SIZE; i++)
- {
- cout << "Group: "; cin >> table[i].group;
- cout << "Surname: "; cin >> table[i].surname;
- for (int n = 0; n < 5; n++)
- {
- table[i].subjects[n] = rand() % 3 + 2;
- cout << "Subject " << n + 1 << ": " << table[i].subjects[n] << endl;
- }
- }
- cout << endl << "Underperforming students" << endl;
- for (int i = 0; i < SIZE; i++)
- {
- int debt = 0;
- for (int n = 0; n < 5; n++)
- if (table[i].subjects[n] == 2)
- debt++;
- if (debt)
- {
- cout << table[i].group << " ";
- cout << table[i].surname << endl;
- cout << "Debts: " << debt << endl << endl;
- }
- debt = 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement