该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
struct student
{
int age;
float score;
char name[100];
};
int main(void)
{
printf("学生管理系统\n\n");
int len,i,j,k,l;
struct student * parr;
struct student t;
printf("请输入学生个数");
scanf("%d", &len);
parr = (struct student *)malloc (len * sizeof(struct student));
//输入学生信息
for (i=0; i
{
printf("age = ");
scanf("%d ",&parr[i].age);
printf("score = ");
scanf("%f",&parr[i].score);
printf("name = ");
scanf("%s", parr[i].name);
}
//排序
printf("\n\n\n");
for(j=0; j
{for(k=0; k
{ if(parr[k].score > parr[k+1].score)
{ t = parr[k];
parr[k]=parr[k+1];
parr[k+1]= t;
}
}
}
printf("\n\n\n");
//输出学生信息
for (l=0; l
{ printf("age = %d\n", parr[i].age);
printf("score =%f\n ",parr[i].score);
printf("name =%s \n", parr[i].name);
}
return 0;
}
运行时到输入这一阶段,在age后就没下文了,不知道为什么
学生信息管理系统