求C语言课程设计 运动会管理系统

2024-12-14 12:44:46
推荐回答(1个)
回答1:

搞诉我地址,我可以发给你
试试这个,论文也有
#include
#define A 100
int y=0,f=0,j,W,M,N,p[15],q[15];
struct student
{ char shool[20];
char name[20];
char item[20];
char sex;
int position;
int mark;
}stu[A];

struct item
{ char name[20];
char sex;
int mark;
}it[A];

struct shool
{ char name[20];
char item[20];
int mark;
}sho[A];

main()
{
menu();
}

menu()
{ int w1,n;
do
{ puts("\t\t*****************MENU********************");
puts("\n\n\t\t 1.The information to writein\n");
puts("\t\t 2.The race result records to writein\n");
puts("\t\t 3.Search the information\n");
puts("\t\t 4.Exit\n");
puts("\n\t\t*****************************************");
puts("\n\nChoice you number:");
scanf("%d",&n);
if(n<1||n>4){w1=1;getchar();}
else w1=0;
}while(w1==1);
switch(n)
{ case 1:establish();break;
case 2:enter();break;
case 3:search();break;
case 4:exit(0);
}
}

establish()
{ int h,r; extern N,M,W;
y=1;
printf("\nThe number of shool attended is:");
scanf("%d",&N);
printf("\nThe number of men item is:");
scanf("%d",&M);
printf("\nThe number of women item is:");
scanf("%d",&W);
printf("\nThere are three form of marked you can choice:");
printf("\n\n\t1).1th--7,2th--5,3th--3,4th--2,5th--1.");
printf("\n\n\t2).1th--5,2th--3,3th--1.");
printf("\n\n\t3).Define by youself.");
loop: printf("\n\nChoice the number(1--3):");
scanf("%d",&h);
if(h>0&&h<4)
switch(h)
{case 1:j=1;break;
case 2:j=2;break;
case 3:define_mark();
}
else goto loop;
printf("Success!!!\nPress any key+Enter to menu..");scanf("%d",&r);
menu();
}

enter()
{ int t,r,i=0;extern j,y;char F,M;
if(y==0)
{ printf("Please establish system first!!\nPress any key+Enter to menu.. ");
scanf("%d",&r);
menu();
}
do
{
printf("\nPlease enter the student's name:\t");scanf("%s",&stu[i].name);
printf("\nPlease enter the student's shool:\t");scanf("%s",&stu[i].shool);
printf("\nPlease enter the student's item:\t");scanf("%s",&stu[i].item);
loop_1: printf("\nPlease enter the student's sex(W or M):\t");scanf("%s",&stu[i].sex);
if(stu[i].sex!='W'&&stu[i].sex!='M')goto loop_1;
printf("\nPlease enter the student's position:\t");scanf("%d",&stu[i].position);
mark(j,i);
loop_2:printf("\n\nDo again?\t1).Yes\t2).No\t");
scanf("%d",&t);
if(t!=2&&t!=1)goto loop_2;
if(t==2)break;
i++;
}while(t==1);f=1;
printf("Success!!!\nPress any key+Enter to menu..");scanf("%d",&r);
menu();
}

search()
{ int e;char c;extern f;
if(f==0)
{ printf("Please enter the data first!!\nPress any key+Enter to menu..\n ");
scanf("%s",&c);
menu();
}
loop:printf("\nThe form of searching you want to choice:\n\t1).By school\n\t2).Bt item\n\t3).To menu\t");
scanf("%d",&e);
switch(e)
{ case 1:search_school();break;
case 2:search_item();break;
case 3:menu();
}
if(e>4||e<1)goto loop;
printf("Press any key+Enter to menu..");scanf("%s",&c);menu();
}

search_school()
{ int x,sum=0,w=0;
struct student s;
printf("\nPlease enter the name of the school that you want to search:");
scanf("%s",&s.shool);
printf_face();
for(x=0;x if(strcmp(s.shool,stu[x].shool)==0)
{ sum+=stu[x].mark;
printf_one(x);w=1;
}
printf_sum(sum);
if(w==0)
{printf("\n\n*The name is wrong,press again!");search_school();}

}

search_item()
{ int x,sum=0,w=0;
struct student s;
printf("\nPlease enter the name of the item that you want to search:");
scanf("%s",&s.item);
printf_face();
for(x=0;x if(strcmp(s.item,stu[x].item)==0)
{ sum+=stu[x].mark;
printf_one(x);w=1;
}
printf_sum(sum);
if(w==0)
{ printf("\n\n*The name is wrong,press again!");search_item();}

}
mark(int j,int i)
{ int g; extern p[15],q[15];
if(j==1)
{if(stu[i].position==1)stu[i].mark=7;
else if(stu[i].position==2)stu[i].mark=5;
else if(stu[i].position==3)stu[i].mark=3;
else if(stu[i].position==4)stu[i].mark=2;
else if(stu[i].position==5)stu[i].mark=1;
}
if(j==2)
{ if(stu[i].position==1)stu[i].mark=5;
else if(stu[i].position==2)stu[i].mark=3;
else if(stu[i].position==3)stu[i].mark=1;
}
if(j==3)
{ for(g=0;g<15;g++)if(stu[i].position==p[g])stu[i].mark=q[g];}

}

define_mark()
{ static int p[15],q[15],a,b,j;
for(a=0;a<15;a++)
{ printf("\nThe position(1--15):");scanf("%d",&p[a]);
printf("\nThe mark you want to define(Integral):");scanf("%d",&q[a]);
loop:printf("\nDo you want define more:\t1).Yes\t2).No");scanf("%d",&b);
if(b==2)break;
if(b!=1)goto loop;
}
j=3;
}

printf_one(int x)
{ printf("\n%-20s%-20s%-20s%-5c%-9d%-5d",stu[x].shool,stu[x].name,stu[x].item,stu[x].sex,stu[x].position,stu[x].mark);
}

printf_sum(int sum)
{ printf("\n\nThe sum of mark is:\t %d",sum);
printf("\nThe shool number is: \t%d",N);
printf("\nThe item number is: \t%d\n",W+M);
}
printf_face()
{ printf("\n\nSchool name student name item sex position mark");
}