// Подсчет среднего балла каждого студента
for (int i = 0; i < kol_vo_students; ++i) {
double summa = 0;
for (int j = 0; j < kol_vo_otsenok; ++j) {
summa += kol_vo_otsenok[i][j];
}
kol_vo_otsenok[i] = summa / kol_vo_otsenok;
Это что?!Вместо получения средней оценки студента суммируешь что?!!! #include
#include
#include
#include
#define RAND(min, max) (rand() % ((max) - (min)) + (min))
int main() {
system("chcp 1251 > NUL");
srand(static_cast(time(nullptr)));
constexpr size_t kol_vo_students = 30;
constexpr size_t kol_vo_otsenok = 5;
int otsenki_studentov[kol_vo_students][kol_vo_otsenok]{};
double sredniye_otsenki_studentov[kol_vo_students]{};
size_t i = 0;
for (auto& row : otsenki_studentov) {
std::cout << std::setw(2) << ++i << ". ";
for (auto& value : row) {
value = RAND(2, 6);
std::cout << std::setw(4) << value << ' ';
}
puts("");
}
puts("");
i = 0;
for (const auto& row : otsenki_studentov) {
auto summa = 0.0;
for (auto value : row) {
summa += value;
}
sredniye_otsenki_studentov[i] = summa / kol_vo_otsenok;
++i;
}
i = 0;
std::cout << std::fixed << std::setprecision(1);
for (auto average : sredniye_otsenki_studentov) {
std::cout << "Студент " << std::setw(2) << i + 1
<< ": Средний балл = " << sredniye_otsenki_studentov[i] << '\n';
++i;
}
system("pause > nul");
}