Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<cstring>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int minZp = 330;
- cout << "Введите кол-во студентов: ";
- int n;
- cin >> n;
- string* fn = new string[n];
- string* sn = new string[n];
- string* tn = new string[n];
- int* gr = new int[n];
- double* ball = new double[n] ;
- int* zp = new int[n];
- for (int i = 0; i < n; i++) {
- cout << "ФИО " << i + 1 << " стундента: ";
- cin >> fn[i] >> sn[i] >> tn[i];
- cout << "Группа, ср. балл, доход на члена семьи " << i + 1 << " стундента: ";
- cin >> gr[i] >> ball[i] >> zp[i];
- }
- int kol = 0;
- for (int i = 0; i < n; i++)
- if (zp[i] < minZp * 2) {
- swap(fn[i], fn[kol]);
- swap(sn[i], sn[kol]);
- swap(tn[i], tn[kol]);
- swap(gr[i], gr[kol]);
- swap(ball[i], ball[kol]);
- swap(zp[i], zp[kol]);
- kol++;
- }
- for (int i = kol; i < n - 1; i++)
- for (int j = kol; j < n - i; j++)
- if (ball[j] < ball[j + 1]) {
- swap(fn[j], fn[j + 1]);
- swap(sn[j], sn[j + 1]);
- swap(tn[j], tn[j + 1]);
- swap(gr[j], gr[j + 1]);
- swap(ball[j], ball[j + 1]);
- swap(zp[j], zp[j + 1]);
- }
- for (int i = 0; i < n; i++) {
- cout << fn[i] << " " << sn[i] << " " << tn[i] << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement