#define n 20
#define m 20
#define w 20
#define True 1
#define NULL 0
typedef struct
{
int program;
int score;
}Scores;
typedef struct
{number;
Scores data[m+w];
}NB;
typedef struct School
{
int clascore;
struct School *next;
NB *point;
}School,*LinkList;
/*LinkList *r;*/
Pro_ST(LinkList r)
{int i;
for(i=0;i<m+w;i++)
scanf("%d:%d",r->point->data[i].program,r->point->data[i].score);
return(True);
}
int s[n];
void Sch_Score(LinkList r)
{int e,i,j=1,sum=0;
scanf("%d",&e);
for(;r->next!=NULL;r=r->next)
{
for(i=0;i<m+w;i++)
{
if(r->point->number=e)
sum=sum+r->point->data[i].score;
}
printf("%d:%d\n",r->point->number,sum);
s[j]=sum;j++;
}
}
void SSList(LinkList r)
{int i;
for(i=1;i<=n;i++,r=r->next)
printf("%d:%d,%d\n",r->point->number,s[i],r->clascore);
}
void Sch_Num_Pro(LinkList r)
{int num,j;
scanf("%d",&num);
for(;r->next!=NULL;r=r->next)
for(j=1;j<=m+w;j++)
if(num==r->point->number) printf("%d:%d\n",r->point->data[j].program,r->point->data[j].score);
}
int Pro_Num_Sch(LinkList r)
{int j,pro;
scanf("%d",&pro);
for(;r->next!=NULL;r=r->next)
for(j=1;j<=m+w;j++)
{if(pro==r->point->data[j].program)
printf("%d\n",r->point->number);
}
return(True);
}
LinkList *fp;
main()
{
int i,Z;char l[15];
School h;
Z=Pro_ST(&h);
for(i=1;i<=n;i++)
/*fread(School,sizeof(struct School),1,fp);*/
for(i=0;i<15;i++)
{printf("<1>.Sch_Score;\n<2>.SSList\n;<3>.Sch_Num_Pro;\n<4>Pro_Num_Sch;\nplease sleact one menu to continue...\n");
scanf("%s",l);
switch(l[2])
{
case '1':Sch_Score(&h);break;
case '2':SSList(&h);break;
case '3':Sch_Num_Pro(&h);break;
case '4':Z=Pro_Num_Sch(&h);break;
}
while(l[2]=='#')
break;
}
return(True);
}