QZHY-HTX / Data-Structure

泉州海洋职业学院信息工程学院2023-2024学年第二学期数据结构课程仓库
MIT License
6 stars 9 forks source link

2302580085何盈菲 #59

Open postureF opened 7 months ago

postureF commented 7 months ago

include

include

typedef struct { int id; float score; } Student;

void input_students(Student* students, int n) { for (int i = 0; i < n; i++) { printf("请输入第%d个学生的学号: ", i + 1); scanf("%d", &students[i].id); printf("请输入%d的考试成绩: ", students[i].id); scanf("%f", &students[i].score); } }

int x,y,z;int temp; for(x = 0;x<n-1;x++){ z = x; for(y =y+1;y<n;y++){ if(student[y] > student[z]) z = y; temp = student[z];student[z] = student[x];student[x] = temp; printf("student[z],studennt[y],student[x]"); } return 0; }