Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <windows.h>
- using namespace std;
- struct Students
- {
- string Name;
- float at;
- float sr;
- int ses[4];
- };
- int main()
- {
- float sum = 0;
- SetConsoleOutputCP(1251);
- SetConsoleCP(1251);
- setlocale(LC_ALL,"");
- Students gr[5];
- for (int i = 0; i < 5; i++)
- {
- cout << "Имя : ";
- cin >> gr[i].Name;
- cout << "Средний бал за аттестат : ";
- cin >> gr[i].at;
- cout << "Оценки за последнюю сессию : ";
- for (int j = 0; j < 4; j++)
- cin >> gr[i].ses[j];
- cout << endl;
- }
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- sum += gr[i].ses[j];
- }
- gr[i].sr = sum / 4;
- sum = 0;
- }
- cout << "Студенты, у которых средний балл по итогам сессии ниже среднего балла аттестата\n";
- for (int i = 0; i < 5; i++)
- {
- if (gr[i].sr < gr[i].at) cout << "Имя: " << gr[i].Name << "\n" << "Средний бал аттестата : " << gr[i].at << "\n" << "Средняя оценка за экзамен : " << gr[i].sr << "\n";
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement