You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zyy-001/课程设计源代码_学校运动会管理系统_计算机类1805_...

366 lines
8.1 KiB

6 years ago
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include <time.h>
#define load sizeof(student)
#define N 7
void read();
void save();
6 years ago
6 years ago
int size=3;
struct student
{
char num[10];
char name[20];
int scorem,scoreq,scoreg,scorey;
char ximing[20];
}stu[N],temp;
6 years ago
6 years ago
void input()
6 years ago
{
system("cls");
printf("\t************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>************\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,100<30>ɼ<EFBFBD><><C7A6><EFBFBD>ɼ<EFBFBD>,<2C><><EFBFBD>߳ɼ<DFB3>,<2C><>Զ<EFBFBD>ɼ<EFBFBD><><CFB5>:\n");
for(int i=0;i<size;i++)
scanf("%s%s%d%d%d%d%s",&stu[i].num,&stu[i].name,&stu[i].scorem,&stu[i].scoreq,&stu[i].scoreg,&stu[i].scorey,&stu[i].ximing);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,100<30>ɼ<EFBFBD><><C7A6><EFBFBD>ɼ<EFBFBD>,<2C><><EFBFBD>߳ɼ<DFB3>,<2C><>Զ<EFBFBD>ɼ<EFBFBD><><CFB5>:\n");
for(int i=0;i<size;i++)
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
}
6 years ago
void find()
6 years ago
{
system("cls");
printf("\t************<2A><><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>************\n");
char fs[20];
read();
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",&fs);
for(int i=0;i<size;i++)
{
if(strcmp(stu[i].num,fs)==0)
{
printf("<EFBFBD><EFBFBD>Ҫ<EFBFBD>ҵ<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>:\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,100<30>׳ɼ<D7B3><><C7A6><EFBFBD>ɼ<EFBFBD>,<2C><><EFBFBD>߳ɼ<DFB3>,<2C><>Զ<EFBFBD>ɼ<EFBFBD><><CFB5>:\n");
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
break;
}
else if(strcmp(stu[i].name,fs)==0)
{
printf("<EFBFBD><EFBFBD>Ҫ<EFBFBD>ҵ<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD>:\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,100<30>׳ɼ<D7B3><><C7A6><EFBFBD>ɼ<EFBFBD>,<2C><><EFBFBD>߳ɼ<DFB3>,<2C><>Զ<EFBFBD>ɼ<EFBFBD><><CFB5>:\n");
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
break;
}
else
{
printf("<EFBFBD><EFBFBD>Ҫ<EFBFBD>ҵ<EFBFBD><EFBFBD>˶<EFBFBD>Աδ<EFBFBD>ҵ<EFBFBD>:\n");
printf("<EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Աȱ<EFBFBD><EFBFBD><EFBFBD>򲻴<EFBFBD><EFBFBD><EFBFBD>!");
break;
}
}
}
6 years ago
void paixu()
6 years ago
{
system("cls");
printf("\t************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>************\n");
printf("<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>׵ijɼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
for(int i=0;i<size;i++)
{
for(int j=i+1;j<size;j++)
{
if(stu[i].scorem<stu[j].scorem)
{
temp=stu[i];
stu[i]=stu[j];
stu[j]=temp;
}
}
}
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
for(int i=0;i<size;i++)
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
}
6 years ago
void xiugai()
6 years ago
{
system("cls");
printf("\t************<2A>޸Ľ<DEB8><C4BD><EFBFBD>************\n");
char ch2[20],c;
char num[10],name[20];
int scorem,scoreq,scoreg,scorey,i;
char ximing[20];
printf("ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
read();
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>޸<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",ch2);
for(i=0;i<size;i++)
{
if(strcmp(stu[i].name,ch2)==0)
{
printf("1.<2E>޸ĺ<DEB8><C4BA><EFBFBD>\n2.<2E>޸<EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>\n3.<2E>޸<EFBFBD>100<30>׳ɼ<D7B3>\n4.<2E>޸<EFBFBD>Ǧ<EFBFBD><C7A6><EFBFBD>ɼ<EFBFBD>\n5.<2E>޸<EFBFBD><DEB8><EFBFBD><EFBFBD>߳ɼ<DFB3>\n6.<2E>޸<EFBFBD><DEB8><EFBFBD>Զ<EFBFBD>ɼ<EFBFBD>\n7.<2E>޸<EFBFBD>ϵ<EFBFBD><CFB5>\n");
scanf("%d",&c);
switch(c)
{
case 1:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĵ<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",&num);
strcpy(stu[i].num,num);
break;
}
case 2:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĵ<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
scanf("%s",&name);
strcpy(stu[i].name,name);
break;}
case 3:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ĵ<EFBFBD><EFBFBD>˶<EFBFBD>Ա100<EFBFBD>׳ɼ<EFBFBD>:");
scanf("%d",&scorem);
stu[i].scorem=scorem;
break;
}
case 4:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD>˶<EFBFBD>ԱǦ<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>:");
scanf("%d",&scoreq);
stu[i].scoreq=scoreq;
break;
}
case 5:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>߳ɼ<EFBFBD>:");
scanf("%d",&scoreg);
stu[i].scoreq=scoreq;
break;
}
case 6:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD>Զ<EFBFBD>ɼ<EFBFBD>:");
scanf("%d",&scorey);
stu[i].scorey=scorey;
break;
}
case 7:
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD><EFBFBD>˶<EFBFBD>Աϵ<EFBFBD><EFBFBD>:");
scanf("%s",&ximing);
strcpy(stu[i].ximing,ximing);
break;
}
default:
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
}
printf("<EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
for(int i=0;i<size;i++)
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
}
}
save();
}
6 years ago
void defen()
6 years ago
{
system("cls");
printf("\t************<2A>÷ֽ<C3B7><D6BD><EFBFBD>************\n");
int x,y,z,w,o,p,q,i;
char ch1[20]="jisuanji",ch2[20]="tumu",ch3[20]="yejin";
printf("ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
read();
printf("<EFBFBD><EFBFBD>ϵ<EFBFBD>ĵ÷<EFBFBD><EFBFBD>ܷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
for(i=0;i<size;i++)
{
if(stu[i].scorem==1) x=3;
else if(stu[i].scorem==2) x=2;
else if(stu[i].scorem==3) x=1;
else x=0;
if(stu[i].scoreq==1) y=3;
else if(stu[i].scoreq==2) y=2;
else if(stu[i].scoreq==3) y=1;
else y=0;
if(stu[i].scoreg==1) z=3;
else if(stu[i].scoreg==2) z=2;
else if(stu[i].scoreg==3) z=1;
else z=0;
if(stu[i].scorey==1) w=3;
else if(stu[i].scorey==2) w=2;
else if(stu[i].scorey==3) w=1;
else w=0;
}
6 years ago
6 years ago
for(i=0;i<size;i++)
{
if(strcmp(stu[i].ximing,ch1)==0)
{
o=x+y+z+w;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>ܵ÷<EFBFBD>:%d\n",o);
}
else if(strcmp(stu[i].ximing,ch2)==0)
{
p=x+y+z+w;
printf("<EFBFBD><EFBFBD>ľϵ<EFBFBD>ܵ÷<EFBFBD>:%d\n",p);
}
else if(strcmp(stu[i].ximing,ch3)==0)
{
q=x+y+z+w;
printf("ұ<EFBFBD><EFBFBD>ϵ<EFBFBD>ܵ÷<EFBFBD>:%d\n",q);
}
}
}
6 years ago
void shancchu()
6 years ago
{
system("cls");
printf("\t************ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>************\n");
char ch1[20];
printf("ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
int i;
read();
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
scanf("%s",&ch1);
for(i=0;i<size;i++)
{
if(strcmp(stu[i].name,ch1)==0)
{
for(int j=i;j<size-1;j++)
stu[j]=stu[j+1];
}
}
printf("ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
for(i=0;i<size-1;i++)
{
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
}size--;
save();
}
6 years ago
void charu()
6 years ago
{
system("cls");
int a;
printf("\t************<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>************\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%d",&a);
for(int j=0;j<a;j++)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",&stu[size].num);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",&stu[size].name);
printf("100<EFBFBD>׳ɼ<EFBFBD>:");
scanf("%d",&stu[size].scorem);
printf("Ǧ<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>:");
scanf("%d",&stu[size].scoreq);
printf("<EFBFBD><EFBFBD><EFBFBD>߳ɼ<EFBFBD>:");
scanf("%d",&stu[size].scoreg);
printf("<EFBFBD><EFBFBD>Զ<EFBFBD>ɼ<EFBFBD>:");
scanf("%d",&stu[size].scorey);
printf("ϵ<EFBFBD><EFBFBD>:");
scanf("%s",&stu[size].ximing);
for(int i=0;i<size+1;i++)
for(int j=i+1;j<size+1;j++)
if(stu[i].scorem<stu[j].scorem)
6 years ago
{
6 years ago
temp=stu[i];
stu[i]=stu[j];
stu[j]=temp;
}
size++;
}
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n");
for(int i=0;i<size;i++)
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
save();
}
6 years ago
void save()
6 years ago
{
6 years ago
FILE *fp;
if((fp=fopen("c:\\xiao.txt","w"))==NULL)
6 years ago
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...Saving the file......\n");
6 years ago
for(int i=0;i<size;i++)
fprintf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
6 years ago
fclose(fp);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>....Save the file successfully!\n");
}
void read()
{
6 years ago
FILE *fp;
if((fp=fopen("c:\\xiao.txt","r"))==NULL)
6 years ago
fscanf(fp,"<EFBFBD>˶<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>,100<30>ɼ<EFBFBD><><C7A6><EFBFBD>ɼ<EFBFBD>,<2C><><EFBFBD>߳ɼ<DFB3>,<2C><>Զ<EFBFBD>ɼ<EFBFBD><><CFB5>:\n");
for(int i=0;i<size;i++)
{
fscanf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%s\n",&stu[i].num,&stu[i].name,&stu[i].scorem,&stu[i].scoreq,&stu[i].scoreg,&stu[i].scorey,&stu[i].ximing);
printf("%s\t%s\t%d\t%d\t%d\t%d\t%s\n",stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);
}
6 years ago
fclose(fp);
6 years ago
}
void menu()
{
int ch1;
char ch2;
6 years ago
struct tm *pt;
6 years ago
time_t t;
t=time(NULL);
6 years ago
pt=localtime(&t);
6 years ago
do{
6 years ago
printf("\t\t<EFBFBD><EFBFBD>ǰϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d-%d-%d\n",pt->tm_year+1900,pt->tm_mon+1,pt->tm_mday);
6 years ago
printf("======================<3D>˵<EFBFBD>=====================\n");
printf(" 1.<2E><><EFBFBD><EFBFBD> 2.<2E><><EFBFBD><EFBFBD> \n");
printf(" 3.<2E><><EFBFBD><EFBFBD> 4.<2E>޸<EFBFBD> \n");
printf(" 5.<2E>÷<EFBFBD> 6.ɾ<><C9BE> \n");
printf(" 7.<2E><><EFBFBD><EFBFBD> 8.<2E><><EFBFBD><EFBFBD> \n");
printf(" 9.<2E><>ʾ 0.<2E>˳<EFBFBD>\n");
printf("===============================================\n");
6 years ago
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><0-9>:[ ]\b\b");
6 years ago
scanf("%d",&ch1);
switch(ch1)
{
case 1:
input();
break;
case 2:
find();
break;
case 3:
paixu();
break;
case 4:
xiugai();
break;
case 5:
defen();
break;
case 6:
6 years ago
shancchu();
6 years ago
break;
case 7:
charu();
break;
case 8:
save();
break;
case 9:
read();
break;
case 0:
exit(0);
default:
printf("δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κβ<EFBFBD><EFBFBD><EFBFBD>!");
}
printf("\n");
printf("<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>밴y\n");
getchar();
scanf("%2c",&ch2);
6 years ago
}while(ch2=='y');
6 years ago
}
6 years ago
6 years ago
int main(void)
{
6 years ago
system("color f");
6 years ago
menu();
}