|
|
|
@ -129,7 +129,7 @@ struct studentform{
|
|
|
|
|
}
|
|
|
|
|
fprintf(fp,"%5d",n);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
printf("********************\n");}
|
|
|
|
|
printf("*************************\n");}
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -194,7 +194,7 @@ struct studentform{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ggy2(struct xmform1 xm1[],struct studentform student[],struct schoolform school[],int schoolgs,int studentrs){
|
|
|
|
|
printf("请输入这一类项目的个数:\n");
|
|
|
|
|
printf("请输入该类项目的个数:\n");
|
|
|
|
|
int n;
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
getchar();
|
|
|
|
@ -297,7 +297,7 @@ struct studentform{
|
|
|
|
|
printf("已输入%d个项目的情况\n",i+1);
|
|
|
|
|
}
|
|
|
|
|
printf("输入结束\n");
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -397,7 +397,7 @@ struct studentform{
|
|
|
|
|
}else{
|
|
|
|
|
printf("没有这个选手的信息\n");
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -422,7 +422,7 @@ struct studentform{
|
|
|
|
|
}else{
|
|
|
|
|
printf("没有这个选手的信息\n");
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -447,7 +447,7 @@ struct studentform{
|
|
|
|
|
}else{
|
|
|
|
|
printf("没有这个项目的信息\n");
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -472,7 +472,7 @@ struct studentform{
|
|
|
|
|
}else{
|
|
|
|
|
printf("没有这个项目的信息\n");
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -497,7 +497,7 @@ struct studentform{
|
|
|
|
|
}else{
|
|
|
|
|
printf("没有这个学校的信息\n");
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -522,63 +522,83 @@ struct studentform{
|
|
|
|
|
}else{
|
|
|
|
|
printf("没有这个学校的信息\n");
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void schoolph(struct schoolform school[],int schoolgs){
|
|
|
|
|
int max=school[0].scoer; int maxnumber=0;
|
|
|
|
|
int ph[50];
|
|
|
|
|
//int max=school[0].scoer; int maxnumber=0;
|
|
|
|
|
struct schoolform school1[schoolgs];
|
|
|
|
|
|
|
|
|
|
//int ph[50];
|
|
|
|
|
int i,i1,t,t1;
|
|
|
|
|
char i2[10];
|
|
|
|
|
t1=schoolgs;
|
|
|
|
|
for(i1=0;i1<schoolgs;i1++){
|
|
|
|
|
for(i=0;i<schoolgs;i++){
|
|
|
|
|
school1[i]=school[i];
|
|
|
|
|
}
|
|
|
|
|
//printf("看这里*****%d",school1[0].scoer);
|
|
|
|
|
int max=school1[0].scoer; int maxnumber=0;
|
|
|
|
|
for(i1=0;i1<t1;i1++){
|
|
|
|
|
for(i=0;i<schoolgs;i++){
|
|
|
|
|
if(school[i].scoer>max){
|
|
|
|
|
max=school[i].scoer;
|
|
|
|
|
maxnumber=i;
|
|
|
|
|
}}
|
|
|
|
|
t=school[schoolgs-1].scoer;
|
|
|
|
|
school[schoolgs-1].scoer=max;
|
|
|
|
|
school[maxnumber].scoer=t;
|
|
|
|
|
schoolgs-=1;
|
|
|
|
|
ph[i1]=maxnumber;
|
|
|
|
|
max=school[0].scoer; maxnumber=0;
|
|
|
|
|
if(school1[i].scoer>max){
|
|
|
|
|
max=school1[i].scoer;
|
|
|
|
|
maxnumber=i;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t=school1[schoolgs-1].scoer;
|
|
|
|
|
school1[schoolgs-1].scoer=max;
|
|
|
|
|
school1[maxnumber].scoer=t;
|
|
|
|
|
strcpy(i2,school1[schoolgs-1].name);
|
|
|
|
|
strcpy(school1[schoolgs-1].name,school1[maxnumber].name);
|
|
|
|
|
strcpy(school1[maxnumber].name,i2);
|
|
|
|
|
schoolgs-=1;
|
|
|
|
|
//ph[i1]=maxnumber;
|
|
|
|
|
max=school1[0].scoer; maxnumber=0;
|
|
|
|
|
}
|
|
|
|
|
printf("学校排行由高到低输出依次是:\n\a");
|
|
|
|
|
schoolgs=t1;
|
|
|
|
|
|
|
|
|
|
//printf("学校个数是%d\n",schoolgs);
|
|
|
|
|
for(i=0;i<schoolgs;i++){
|
|
|
|
|
printf("名称:%s 分数:%d\n",school[ph[i]].name,school[ph[i]].scoer);
|
|
|
|
|
for(i=t1-1;i>=0;i--){
|
|
|
|
|
printf("名称:%s 分数:%d\n",school1[i].name,school1[i].scoer);
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void studentph(struct studentform student[],int studentrs){
|
|
|
|
|
int max=student[0].xm.scoer;int maxnumber=0;
|
|
|
|
|
int ph[50];
|
|
|
|
|
// int max=student[0].xm.scoer;int maxnumber=0;
|
|
|
|
|
struct studentform student1[studentrs];
|
|
|
|
|
//int ph[50];
|
|
|
|
|
int i,i1,t,t1;
|
|
|
|
|
char i2[10];
|
|
|
|
|
t1=studentrs;
|
|
|
|
|
for(i1=0;i1<studentrs;i1++){
|
|
|
|
|
for(i=0;i<studentrs;i++){
|
|
|
|
|
student1[i]=student[i];
|
|
|
|
|
}
|
|
|
|
|
int max=student1[0].xm.scoer;int maxnumber=0;
|
|
|
|
|
for(i1=0;i1<t1;i1++){
|
|
|
|
|
for(i=0;i<studentrs;i++){
|
|
|
|
|
if(student[i].xm.scoer>max){
|
|
|
|
|
max=student[i].xm.scoer;
|
|
|
|
|
maxnumber=i;
|
|
|
|
|
}}
|
|
|
|
|
t=student[studentrs-1].xm.scoer;
|
|
|
|
|
student[studentrs-1].xm.scoer=max;
|
|
|
|
|
student[maxnumber].xm.scoer=t;
|
|
|
|
|
studentrs-=1;
|
|
|
|
|
ph[i1]=maxnumber;
|
|
|
|
|
max=student[0].xm.scoer; maxnumber=0;
|
|
|
|
|
if(student1[i].xm.scoer>max){
|
|
|
|
|
max=student1[i].xm.scoer;
|
|
|
|
|
maxnumber=i;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t=student1[studentrs-1].xm.scoer;
|
|
|
|
|
student1[studentrs-1].xm.scoer=max;
|
|
|
|
|
student1[maxnumber].xm.scoer=t;
|
|
|
|
|
strcpy(i2,student1[studentrs-1].name);
|
|
|
|
|
strcpy(student1[studentrs-1].name,student1[maxnumber].name);
|
|
|
|
|
strcpy(student1[maxnumber].name,i2);
|
|
|
|
|
studentrs-=1;max=student1[0].xm.scoer; maxnumber=0;
|
|
|
|
|
}
|
|
|
|
|
printf("学生排行由高到低输出依次是:\n\a");
|
|
|
|
|
studentrs=t1;
|
|
|
|
|
for(i=0;i<studentrs;i++){
|
|
|
|
|
printf("姓名:%s 分数:%d\n",student[ph[i]].name,student[ph[i]].xm.scoer);
|
|
|
|
|
|
|
|
|
|
for(i=t1-1;i>=0;i--){
|
|
|
|
|
printf("姓名:%s 分数:%d\n",student1[i].name,student1[i].xm.scoer);
|
|
|
|
|
}
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -611,7 +631,7 @@ struct studentform{
|
|
|
|
|
fscanf(fp,"%10s%10s%3d",school[i].name,school[i].id,&school[i].number);
|
|
|
|
|
}
|
|
|
|
|
printf("读取完毕\n");
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -644,7 +664,7 @@ struct studentform{
|
|
|
|
|
fscanf(fp,"%10s%5s%10s%5d%10s%10s",student[i].name,student[i].xb,student[i].number,&student[i].age,student[i].name1,student[i].xm.name);
|
|
|
|
|
}
|
|
|
|
|
printf("读取完毕\n");
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -653,7 +673,7 @@ int main(){
|
|
|
|
|
system("cls"); //清屏
|
|
|
|
|
system("color 2F"); //调程序颜色背景 (护眼)
|
|
|
|
|
printf("<<**********欢迎来到运动会比赛计分系统**********>>\n");
|
|
|
|
|
printf("此系统有以下功能选项:\n");
|
|
|
|
|
printf("====此系统有以下功能选项:====\n");
|
|
|
|
|
|
|
|
|
|
struct studentform student[50];
|
|
|
|
|
struct schoolform school[10];
|
|
|
|
@ -669,12 +689,12 @@ int main(){
|
|
|
|
|
int b1=1,b2=1; ///b1和b2作为“锁”必须对程序进行初始化输入才能解开
|
|
|
|
|
//scanf("%d",&a);
|
|
|
|
|
do{
|
|
|
|
|
printf("提示:赛前请对程序进行基本信息的输入(1.即完成选手信息的输入和学校信息的输入2.对选手信息和学校信息读档 )\n");
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("输入选手信息并存档(请按0)\n输入学校信息并存档(请按1)\n输入项目信息(请按2)\n寻找并输出选手信息(请按3)\n寻找并输出项目信息(请按4)\n寻找并输出学校信息(请按5)\n学校排行输出(请按6)\n参赛选手排行输出(请按7)\n");
|
|
|
|
|
printf("读档(请按8)\n");
|
|
|
|
|
printf("退出(请按9)\n");
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("==*提示*==:赛前请对程序进行基本信息的输入\n(\n1.没档的,请先完成选手信息的输入和学校信息的输入\n2.若已完成存档的,则只需对选手信息和学校信息读档\n )\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
printf("====输入选手信息并存档(请按0)\n====输入学校信息并存档(请按1)\n====输入项目信息(请按2)\n====寻找并输出选手信息(请按3)\n=====寻找并输出项目信息(请按4)\n=====寻找并输出学校信息(请按5)\n====学校排行输出(请按6)\n====参赛选手排行输出(请按7)\n");
|
|
|
|
|
printf("====读档(请按8)\n");
|
|
|
|
|
printf("====退出(请按9)\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
scanf("%d",&a);
|
|
|
|
|
do{
|
|
|
|
|
if(a==0||a==1||a==8||a==9) { break ;}
|
|
|
|
@ -684,8 +704,8 @@ int main(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
printf("请先完成程序初始化操作(按提示先操作)\n");
|
|
|
|
|
printf("********************\n");
|
|
|
|
|
printf("请先完成程序初始化操作(按提示操作)\n");
|
|
|
|
|
printf("*************************\n");
|
|
|
|
|
printf("请重新按一次(0、1、8)\n");
|
|
|
|
|
scanf("%d",&a);
|
|
|
|
|
}}}while(1);
|
|
|
|
@ -706,8 +726,8 @@ int main(){
|
|
|
|
|
b2=0;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
printf("你选择了输入项目信息功能\n");
|
|
|
|
|
printf("项目有两种一种取前五名,另一种取前三名。\n");
|
|
|
|
|
printf("你选择了输入项目信息功能\n\n");
|
|
|
|
|
printf("项目有两种一类取前五名,另一类取前三名。\n\n");
|
|
|
|
|
printf("开始第一类项目信息输入\n");
|
|
|
|
|
xmgs1=ggy2(xm1,student,school,schoolgs,studentrs);
|
|
|
|
|
printf("开始第二类项目信息输入\n");
|
|
|
|
@ -834,13 +854,13 @@ int main(){
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 9:
|
|
|
|
|
printf("成功退出,感谢使用!\n");
|
|
|
|
|
return 0;
|
|
|
|
|
printf("成功退出,感谢使用!\n\a");
|
|
|
|
|
return 0;
|
|
|
|
|
default:
|
|
|
|
|
printf("请按(0~9)以内的数字\n");
|
|
|
|
|
}
|
|
|
|
|
}while(1);
|
|
|
|
|
return 0;
|
|
|
|
|
printf("请按(0~9)以内的数字\n\n");
|
|
|
|
|
}
|
|
|
|
|
}while(1);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|