|
|
|
@ -143,6 +143,154 @@ p->next=NULL;
|
|
|
|
|
menu();
|
|
|
|
|
return head;
|
|
|
|
|
}
|
|
|
|
|
/********************输 出 函 数********************/
|
|
|
|
|
void output(scl *head)
|
|
|
|
|
{
|
|
|
|
|
scl *q=head;
|
|
|
|
|
int i,x,y=1;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int number;
|
|
|
|
|
printf("****1---------不输出,存入文件\n");
|
|
|
|
|
printf("****2---------输出,不存入文件\n");
|
|
|
|
|
scanf("%d",&number);
|
|
|
|
|
switch(number)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
fp=fopen("d:\\clanguage.txt","w+");
|
|
|
|
|
if(fp==NULL)
|
|
|
|
|
{printf("无法打开文件!");exit(0);}
|
|
|
|
|
while(q!=NULL)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"学校编码为:%d",q->sclnum);
|
|
|
|
|
fprintf(fp,"学校名称为:%s\n",q->sclname);
|
|
|
|
|
for(x=0;x<W+M;x++)
|
|
|
|
|
{
|
|
|
|
|
fprintf(fp,"项目种类为:%d",q->a[x].itmkind);
|
|
|
|
|
fprintf(fp,"项目名称为:%s\n",q->a[x].itmname);
|
|
|
|
|
fprintf(fp,"获奖数目为:%d\t\n",q->a[x].level);
|
|
|
|
|
for(i=0;i<q->a[x].level;i++)
|
|
|
|
|
fprintf(fp,"第%d名",q->a[x].range[i]);
|
|
|
|
|
fprintf(fp,"得主:%s\n",q->a[x].name);
|
|
|
|
|
fprintf(fp,"\n");
|
|
|
|
|
}
|
|
|
|
|
q=q->next;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}break;
|
|
|
|
|
case 2:
|
|
|
|
|
while(q!=NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("★-------------------------------------结果公示-------------------------------------★\n");
|
|
|
|
|
printf("*--------------------------------------学校编号:\t");
|
|
|
|
|
printf("%d\n",q->sclnum);
|
|
|
|
|
printf("*--------------------------------------学校名称:\t");
|
|
|
|
|
printf("%s\n",q->sclname);
|
|
|
|
|
for(x=0;x<W+M;x++)
|
|
|
|
|
{
|
|
|
|
|
printf("*--------------------------------------项目编号:\t");
|
|
|
|
|
printf("%d\n",q->a[x].itmnum);
|
|
|
|
|
printf("*--------------------------------------项目类型:\t");
|
|
|
|
|
printf("%d\n",q->a[x].itmkind);
|
|
|
|
|
printf("*--------------------------------------项目名称:\t");
|
|
|
|
|
printf("%s\n",q->a[x].itmname);
|
|
|
|
|
printf("*--------------------------------------有%d个获奖名次:\t",q->a[x].level);
|
|
|
|
|
for(i=0;i<q->a[x].level;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("第%d名\t",q->a[x].range[i]);
|
|
|
|
|
//printf("%s",q->a[x].name);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
}printf("男子团体项目总分:\t%d\n",q->mscore);
|
|
|
|
|
printf("女子团体项目总分:\t%d\n",q->wscore);
|
|
|
|
|
printf(" 学校项目总得分:\t%d\n\n",q->sum);
|
|
|
|
|
printf("望再接再厉!\n");
|
|
|
|
|
printf("\n");
|
|
|
|
|
q=q->next;
|
|
|
|
|
}break;
|
|
|
|
|
default :
|
|
|
|
|
puts("输入有误!");
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************查 找 函 数***************/
|
|
|
|
|
void find(scl *head)
|
|
|
|
|
{
|
|
|
|
|
scl *q=head;
|
|
|
|
|
int num,x,i,cha,xiang,flag=0;
|
|
|
|
|
printf("按学校查找请输入1,按项目查找请输入2\n");
|
|
|
|
|
scanf("%d",&cha);
|
|
|
|
|
if(cha==1)
|
|
|
|
|
{
|
|
|
|
|
printf("请输入你要查询的学校编号:");
|
|
|
|
|
scanf("%d",&num);
|
|
|
|
|
while(q!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if(num==q->sclnum)
|
|
|
|
|
{
|
|
|
|
|
printf("===================================\n");
|
|
|
|
|
printf("学校编号\n");
|
|
|
|
|
printf("%d\n",q->sclnum);
|
|
|
|
|
for(x=0;x<M+W;x++)
|
|
|
|
|
{
|
|
|
|
|
printf("项目编号\n");
|
|
|
|
|
printf("%d\t\n",q->a[x].itmnum);
|
|
|
|
|
printf("项目类型\n");
|
|
|
|
|
printf("%d\t\n",q->a[x].itmkind);
|
|
|
|
|
printf("有%d个获奖名次:\t",q->a[x].level);
|
|
|
|
|
for(i=0;i<q->a[x].level;i++)
|
|
|
|
|
{
|
|
|
|
|
printf("第%d名\t",q->a[x].range[i]);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
}
|
|
|
|
|
printf("男子团体项目总分:%d\n",q->mscore);
|
|
|
|
|
printf("女子团体项目总分:%d\n",q->wscore);
|
|
|
|
|
printf(" 学校项目总得分:%d\n\n",q->sum);
|
|
|
|
|
printf("\n");
|
|
|
|
|
flag=1;
|
|
|
|
|
printf("\n");
|
|
|
|
|
}
|
|
|
|
|
q=q->next;
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
puts("对不起!没有您要查询的对象");
|
|
|
|
|
}
|
|
|
|
|
else if(cha==2)
|
|
|
|
|
{
|
|
|
|
|
printf("请输入你要查询的项目编号:");
|
|
|
|
|
scanf("%d",&xiang);
|
|
|
|
|
while(q!=NULL)
|
|
|
|
|
{
|
|
|
|
|
for(x=0;x<W+M;x++)
|
|
|
|
|
{
|
|
|
|
|
if(xiang==q->a[x].itmnum&&q->a[x].itmkind==111)
|
|
|
|
|
{
|
|
|
|
|
printf("获得前5名的学校为:\n");
|
|
|
|
|
for(i=0;i<1;i++)
|
|
|
|
|
printf("学校编号和名称分别为:%d,%s\n",q->sclnum,q->sclname);
|
|
|
|
|
flag=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if(xiang==q->a[x].itmnum&&q->a[x].itmkind==222)
|
|
|
|
|
{
|
|
|
|
|
printf("获得前3名的学校为:\n");
|
|
|
|
|
for(i=0;i<3;i++)
|
|
|
|
|
printf("学校编号和名称分别为:%d,%s\n",q->sclnum,q->sclname);
|
|
|
|
|
flag=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
q=q->next;
|
|
|
|
|
}
|
|
|
|
|
if(flag==0)
|
|
|
|
|
puts("对不起!没有您要查询的对象");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**********************主 函 数*************************/
|
|
|
|
|
int main() //主函数1
|
|
|
|
|
{
|
|
|
|
|
int ch;
|
|
|
|
@ -154,8 +302,8 @@ scanf("%d",&ch);
|
|
|
|
|
switch(ch)
|
|
|
|
|
{
|
|
|
|
|
case 1: menu();g=input(); break;
|
|
|
|
|
//case 2: menu();output(g); break;
|
|
|
|
|
//case 3: menu();find(g); break;
|
|
|
|
|
case 2: menu();output(g); break;
|
|
|
|
|
case 3: menu();find(g); break;
|
|
|
|
|
case 4: menu();printf("******************************谢谢您的使用!******************************\n");
|
|
|
|
|
printf("******************************生命在于运动!******************************\n");exit(0);
|
|
|
|
|
default: menu();printf("对不起!输入有误!\n");exit(0);
|