有一个班4个学生,5门课程。一:求第1门课程的平均分;二:找出有两门以上课程不及格的学生,输出他们的学号和全部课程成绩及平均成绩;三:找出平均成绩在90分以上或全部课程成绩在85分以上的学生。分别编3个函数实现以上3个要求。
#include <stdio.h>
#define NUM_STUDENTS 4
#define NUM_COURSES 5
void averageFirstCourse(int scores[NUM_STUDENTS][NUM_COURSES]) {
double total = 0;
for (int i = 0; i < NUM_STUDENTS; i++) {
total += scores[i][0];
}
printf("Average score of the first course: %f\n", total / NUM_STUDENTS);
}
void findFailingStudents(int scores[NUM_STUDENTS][NUM_COURSES]) {
for (int i = 0; i < NUM_STUDENTS; i++) {
int failCount = 0;
for (int j = 0; j < NUM_COURSES; j++) {
if (scores[i][j] < 60) {
failCount++;
}
}
if (failCount >= 2) {
printf("Student %d failed in %d courses. Scores: ", i + 1, failCount);
doubl