#include
struct Student {
char ID[20];
char Name[20];
int Mark;
};
//声明学生数组及学生数量
struct Student students[1000];
int num = 0;
//按学号顺序
void ID_select() {
int i,j;
struct Student t; //中间变量t
for(i = 0;i < num - 1;i++) {//num是全局变量,在输入学生信息时,已经得到更新
for(j = i + 1;j < num;j++) {
if(students[i].ID > students[j].ID) {
t = students[i];
students[i] = students[j];
students[j] = t;
}
}
}
for(i = 0;i < num;i++)
printf("%s\t%s\t%d\n",students[i].ID,students[i].Name,students[i].Mark);
}