基本上我有,
double marks [STUDENTS][ASSIGNMENTS] = { (0.1,0.2,0.3,0.4,0.5,0.6,0.7),
(1,0.9,0.8,0.7,0.6,0.5,0.5),
(0.8,0.8,0.8,0.8,0.8,0.8,0.8),
(0.8,0.9,0.7,0.8,0.9,0.7,0.8),
(0.5,0.6,0.7,0.8,0.9,0.5,0.9)};
我想得到:double studentAverages [STUDENTS]
从studentAverages=calculateStudentAverages(marks);
使用:
double calculateStudentAverages (double marks[STUDENTS][ASSIGNMENTS]){
double averages[STUDENTS];
double average;
for (int i = 0; i < STUDENTS; i++) {
for (int j = 0; j < ASSIGNMENTS; j++) {
average = average + marks[i][j];
}
averages[i]=average/ASSIGNMENTS;
}
return averages;
}
但我得到“无法从'double [5]'转换为'double'”和“无法从'double'转换为'double [5]'”