diff --git a/a.c b/a.c deleted file mode 100644 index d576437..0000000 --- a/a.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#define N 2 -#define M 1 -#define W 1 -typedef struct score -{ -int mark[5]; -int itmnum; -int itmkind; -char itmname[20]; -char name[10]; -int level; -int range[5]; -}sc; -typedef struct school -{ -int sclnum; -char sclname[20]; -sc a[M+W]; -int mscore; -int wscore; -int sum; -struct school *next; -}scl; -scl *p,*q,*head,*g,*s,*u; -void menu() -{ -system("cls"); -printf("★================运动会比赛计分系统================= ★\n"); -printf("** 1-------------------键盘输入 **\n"); -printf("** 2-------------------输出 **\n"); -printf("** 3-------------------文件读入 **\n"); -printf("** 4-------------------查询 **\n"); -printf("** 5-------------------退出 **\n"); -printf("备注:\n"); -printf("**女子前三名依次得分:5分 3分 2分 **\n"); -printf("**男子前五名依次得分:7分 5分 3分 2分 1分 **\n"); -} -int main() -{menu(); -} diff --git a/a.exe b/a.exe deleted file mode 100644 index 42e5e42..0000000 Binary files a/a.exe and /dev/null differ diff --git a/b.c b/beifen11.c similarity index 57% rename from b.c rename to beifen11.c index bc09f48..cdd0e75 100644 --- a/b.c +++ b/beifen11.c @@ -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;xa[x].itmkind); +fprintf(fp,"项目名称为:%s\n",q->a[x].itmname); +fprintf(fp,"获奖数目为:%d\t\n",q->a[x].level); +for(i=0;ia[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;xa[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;ia[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;xa[x].itmnum); +printf("项目类型\n"); +printf("%d\t\n",q->a[x].itmkind); +printf("有%d个获奖名次:\t",q->a[x].level); +for(i=0;ia[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;xa[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); diff --git a/b.exe b/beifen11.exe similarity index 56% rename from b.exe rename to beifen11.exe index 7bfd80c..f40b0d4 100644 Binary files a/b.exe and b/beifen11.exe differ