switch (option) {
case 1: {
string course;
cout << "请输入科目名称(格式为语文、数学、英语、物理、化学、生物):";
cin >> course;
bool found = false;
int index = -1;
for (int j = 0; j < num_of_courses; j++) {
if (courses[j] == course) {
found = true;
index = j;
break;
}
}
if (!found) {
cout << "输入的科目不存在!\n";
break;
}
double sum = 0.0;
double scores_ordered[num_of_students];
for (int i = 0; i < num_of_students; i++) {
sum += scores[i][index];
scores_ordered[i] = scores[i][index];
}
double average_score = sum / num_of_students;
cout << "所有同学" << course << "科目的平均成绩为:"
<< setprecision(2) << fixed << average_score << "\n";
for (int i = 0; i < num_of_students - 1; i++) {
for (int j = i + 1; j < num_of_students; j++) {
你需要检查花括号是否都配对