Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

张百琰2302300246 #58

Open
ZBYMM opened this issue Mar 11, 2024 · 0 comments
Open

张百琰2302300246 #58

ZBYMM opened this issue Mar 11, 2024 · 0 comments

Comments

@ZBYMM
Copy link

ZBYMM commented Mar 11, 2024

#include<stdio.h>
//定义最大学生和课程数量
#define MAX_STUDENTS 100
#define MAX_COURSES 10
//计算平均成绩
float calculateAverage(float scores[],int numCourses){
float sum = 0.0;
for(int i =0;i<numCourses;i++){
sum+=scores[i];
}
return sum/numCourses;
}

//对学生平均分降序排序
void sortStudents(float averages[],int numStudents){
for(int i =0;i<numStudents -1;i++){
for(int j=0;j<numStudents -i-1;j++){
if(averages[i]<averages[i+1]){
swap(&averages[j],&averages[j+1]);
}
}
}
}
int main(){
int numStudents,Courses;
float scores[MAX_STUDENTS][MAX_COURSES];
float averages[MAX_STUDENTS];
printf("请输入学生学号:");
scanf("%d",&numStudents);
return 0;
}
//不会了(T_T) 想不出来。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant