Untitled
unknown
plain_text
2 years ago
1.9 kB
6
Indexable
// ConsoleApplication38.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. // #include <string> #include <iostream> using namespace std; int main() { int quantity, summ=0, empty=0; int marks[100000]; float avrgmark; string iu,ui; setlocale(LC_ALL, "Russian"); cout << "Введите количество учеников в класс\n"; cin >> quantity; for ( int i = 0; i < quantity; i++) { cout << "Балл " << i + 1 << "-го ученика" << endl; cin >> marks[i]; summ += marks[i]; } avrgmark = summ / quantity; cout << "Двоечники:" << endl; for (int i = 0; i < quantity; i++) { if (marks[i] == 2) cout << '№' << i + 1 << endl; else empty++; } if (empty == quantity) cout << "Пусто" << endl; empty = 0; cout << "Троечники:" << endl; for (int i = 0; i < quantity; i++) { if (marks[i] == 3) cout << '№' << i + 1 << endl; else empty++; } if (empty == quantity) cout << "Пусто" << endl; empty = 0; cout << "Хорошисты:" << endl; for (int i = 0; i < quantity; i++) { if (marks[i] == 4) cout << '№' << i + 1 << endl; else empty++; } if (empty == quantity) cout << "Пусто" << endl; empty = 0; cout << "Отличники:" << endl; for (int i = 0; i < quantity; i++) { if (marks[i] == 5) cout << '№' << i + 1 << endl; else empty++; } if (empty == quantity) cout << "Пусто" << endl; empty = 0; cout << "Средний балл по классу:" << avrgmark << endl; cout << "Ученики с баллов больше среднего: "; for (int i = 0; i < quantity; i++) { if (avrgmark == marks[i] || marks[i] == 5) { cout << '№' << i + 1 << ' '; } } }
Editor is loading...