#include <iostream> using namespace std; const int positive = 5; int main () { int n; cout << "Enter the number of students, and grades are separated by spaces:"; cin >> n; int * p = new int [n]; for (int i = 0; i < n; i++) p [i] = 0; int sum = 0, Hmany = 0 failed = 0; for (int i = 0; i < n; i++) { if (p [i] < positive) { if (!failed) cout << "students did not write:"; failed ++; cout << '' << i; } sum + = p [i]; Hmany ++; } cout << endl << n-failed << " studens passed, " << failed << " failed, groups average - " << (double)sum/Hmany << endl; return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)