Вопрос о логике (статус выхода -1)
Всем привет!
Я не понимаю, почему он сказал статус выхода -1?
Любой может помочь. Большое вам спасибо !
Что я уже пробовал:
#include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { vector<string>name {"Johnny", "Wiliam", "Joe", "Maria", "Luis"}; int size_test = 4; double score[5][size_test]; for (int i = 0; i < name.size(); i++) { cout << "Student " << i + 1 << ": " << name[i] << ": " << "\n"; for (int j = 0; j < size_test; j++) { cout << "Score for test #" << j + 1 << ":"; cin >> score[i][j]; } cout << "\n"; } vector<double>total; for (int i = 0; i < name.size(); i++) { double temp_total = 0; for (int j = 0; j < size_test; j++) { temp_total += score[i][j]; } total.push_back(temp_total); } vector<double>subtotal; for (int i = 0; i < name.size(); i++) { double lowest = score[i][0]; for (int j = 1; j < size_test; i++) { if (score[i][j] < lowest) { lowest = score[i][j]; } } double temp_subtotal = total[i] - lowest; subtotal.push_back(temp_subtotal); } vector<double>average; for (int i = 0; i < name.size(); i++) { double temp_average = static_cast<double>(subtotal[i] * 1.0) / (double)((size_test - 1) * 1.0); average.push_back(temp_average); } vector<char>grade; for (int i = 0; i < name.size(); i++) { char temp_grade = ' '; if (average[i] >= 90) { temp_grade = 'A'; } else if (average[i] >= 80 && average[i] < 90) { temp_grade = 'B'; } else if (average[i] >= 70 && average[i] < 80) { temp_grade = 'C'; } else if (average[i] >= 60 && average[i] < 70) { temp_grade = 'D'; } else if (average[i] < 60) { temp_grade = 'F'; } grade.push_back(temp_grade); } cout << "\n"; cout << setprecision(2) << fixed << showpoint; for (int i = 0; i < name.size(); i++) { cout << name[i] << ":" << "\n"; cout << "\t" << "The average score is " << average[i] << "\n"; cout << "\t" << "The grade is " << grade[i] << "\n"; } }