Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- const int size = 20;
- struct study
- {
- char name[20];
- int raiting_math;
- int raiting_phys;
- int raiting_prog;
- };
- using namespace std;
- int main()
- {
- const int size = 20;
- setlocale(LC_ALL, "rus");
- int n = 0;
- cout << "1 - мат. анализ\n2 - физика\n3 - программирование\n";
- cin >> n;
- int amount;
- cout << "amount = ";
- cin >> amount;
- cout << "\n";
- study* p_study = new study[amount];
- p_study[1] = { "Alexey", 6, 5, 7 };
- if (n > 1)
- {
- p_study[2] = { "Pavel", 5, 3, 7 };
- }
- if (n > 2)
- {
- p_study[3] = { "Ilya", 2, 6, 8 };
- }
- if (n > 3)
- {
- p_study[4] = { "Arthur", 7, 5, 9 };
- }
- if (n > 4)
- {
- p_study[5] = { "Lehan", 2, 3, 3 };
- }
- cout << "\nНеуспевающие студенты:\n";
- for (int i = 1; i < amount; i++)
- {
- if (n == 1)
- {
- if (p_study[i].raiting_math < 4)
- {
- cout << p_study[i].name << endl;
- }
- }
- if (n == 2)
- {
- if (p_study[i].raiting_phys < 4)
- {
- cout << p_study[i].name << endl;
- }
- }
- if (n == 3)
- {
- if (p_study[i].raiting_prog < 4)
- {
- cout << p_study[i].name << endl;
- }
- }
- }
- delete[]p_study;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement