求高手帮忙排序问题
#include <stdio.h>#include <string.h>
#define max 3
struct student
{
char num[5];
char name[10];
int score[4];
}
p[]={{"2010","linning",43,22,44,54},{"2012","yanglin",53,54,55,34},{"2011","liuhua",55,64,34,66}};
main()
{
int i,a;
struct student *pp;
pp=p;
printf("num name score\n");
printf("------------------------\n");
for (i=0;i<max;i++,pp++)
if(pp->num>0)
printf("%-8c%-10c%-15d\n",pp->num,pp->name,pp->score);
}
结果排序出来
打印的应该是这样,但我想不到该把排序的代码该怎么写
num name score
-------------------------------
2010 linning 43,22,44,54
2011 liuhua 55,64,34,66
2012 yanglin 53,54,55,34
这个结果就合适了啊
但打印出来的不合适