已经修改完成:
#include
#include
struct Student
{ int num;
char name[20];
char sex;
int age;
float chinese;
float math;
float english;
};
int main()
{ struct Student stu[4]=
{ {1,"zhangshan",'M',20,86.3,88.5,78.5},
{2,"lisi",'F',18,78.5,76.3,68.5},
{3,"wangwu",'M',19,90.2,85.6,84.6},
{4,"zhaoliu",'F',21,76.5,90.5,85.5}
};
int n=4;
int i;
int j;
struct Student temp;
for(i=n-1; i>0; i--)
{ for(j=0; j
{ if(stu[j].chinese { temp=stu[j]; stu[j]=stu[j+1]; stu[j+1]=temp; } } } for(i=0; i printf("%2d%10s%2c%4d%6.2f%6.2f%6.2f\n", stu[i].num,stu[i].name,stu[i].sex,stu[i].age,stu[i].chinese,stu[i].math,stu[i].english); printf("\n"); return 0; }
第1处
第2处
输出结果
这些题目的结构也是非常符。修改起来也是非常困难的。一定要认真仔细的修改。