Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- //#include <windows.h>
- #include <locale.h>
- #include <iomanip>
- using namespace std;
- struct group
- {
- char name[64];
- char surname[64];
- char patronymic[64];
- int phycu;
- int mat;
- int inf;
- int phy;
- };
- void showData(const group q[], int amount);
- int main()
- {
- setlocale(LC_ALL, "Russian");
- const int amount = 3;
- int n = amount;
- group Students[amount] = {};
- for (int i = 0; i < amount; i++)
- {
- cout << "Фамилия: ";
- cin >>Students[i].surname;
- cout << "Имя: ";
- cin >> Students[i].name;
- cout << "Отчество: ";
- cin >> Students[i].patronymic;
- cout << "Математика: ";
- cin >> Students[i].mat;
- cout << "Информатика: ";
- cin >> Students[i].inf;
- cout << "Физика: ";
- cin >> Students[i].phy;
- cout << "Физическая культура (зачет 1/незачет 2): ";
- cin >> Students[i].phycu;
- cout << endl;
- cout << endl;
- }
- for (int i = 0; i < n; ++ i) {
- if (Students[i].mat <= 2 || Students[i].inf <= 2 || Students[i].phy <= 2 || Students[i].phycu == 2) {
- for (int j = i + 1; j < n; ++ j) {
- Students[j - 1] = Students[j];
- }
- -- n;
- -- i;
- }
- }
- showData(Students, n);
- return 0;
- }
- void showData(const group q[], int amount)
- {
- system("clear");
- cout << "# "
- << setw( 15 ) << left << "Фамилия"
- << setw( 11) << "Имя"
- << setw( 16) << "Отчество"
- << setw( 18) << "Математика"
- << setw( 19) << "Информатика"
- << setw( 13) << "Физика"
- << setw( 3 ) << "Ф/к"
- << endl;
- cout << "-----------------------------------------------------------------------------------------------------------" << endl;
- int y = 1;
- for (int i = 0; i < amount; i++)
- {
- cout << y++ << ") "
- << setw(15) << left << q[i].surname
- << setw(11) << q[i].name
- << setw(21) << q[i].patronymic
- << setw(18) << q[i].mat
- << setw(17) << q[i].inf
- << setw(10) << q[i].phy
- << setw(19) << q[i].phycu
- << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement