另贴修改过的代码请大家帮小弟我修改,
另贴修改过的代码请大家帮我修改,十万火急啊
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define maxsize 20
typedef struct mark{
char schoolname[10];
int score;
}Mark;
typedef struct item {
char itemname[10];
int itnum; //项目编号
char itsex; //项目类男,女
Mark amark[3];
}Item;
typedef struct school{
char schoolname[10];
int schoolnumber;
int score;
int mscore;
int wscore;
}School;
int menu(){
int selection=0;
printf( "==============================================\n ");
printf( "退出重新选择请重新输入(0):\n ");
printf( "要按学校编号输出请输入(1):\n ");
printf( "要按学校总分排序输出请输入(2):\n ");
printf( "要按男子团体总分排序输出请输入(3):\n ");
printf( "要按女子团体总分排序输出请输入(4):\n ");
printf( "要查询指定学校的指定项目请输入(5):\n ");
printf( "要按项目编号查询取得前三的学校请输入(6):\n ");
printf( "要输入新项目请输入(7):\n ");
scanf( "%d ",& selection );
getchar();// 吃掉回车
if(selection > =0 && selection <=7)
return selection;
else{
printf( "您选择的选择有误,请重新输入!\n ");
return -1;
}
}
void copy_schoolname(School *as,Item *pitem ,int i1,int j1, int ns1){
int j;
j=0;
// printf( "%s ",pitem[i1].amark[j1].schoolname);
printf( "%d%d%d ",i1,j1,ns1);
while(pitem[i1].itemname[j]!= '\0 '){
as[ns1].schoolname[j]=pitem[i1].amark[j1].schoolname[j];
j++;
}
printf( "%s ",as[ns1].schoolname);
}
int input_to_computer(Item *pitem,int *pc){
int pos=0;
char sx;
printf( "请输入项目类别(男项目:m/女项目:w): \n ");
scanf( "%c ",&sx);
//scanf( "%c ",&sx);
while ((sx!= 'w ') && (sx!= 'W ') && (sx!= 'm ') && (sx!= 'M ')){
printf( "输入有误,请重输入!(男项目:m/女项目:w):\n ");
scanf( "%c ",&sx);
}
pos=pc[0]++;
pitem[pos].itsex=sx;
if ((sx== 'm ') || (sx== 'M ')){
pc[1]++;
}else{
pc[2]++;
}
printf( "请输入要存储的项目名: \n ");
scanf( "%s ",&(pitem[pos].itemname));
printf( "请输入第一名的学校的校名: \n ");
scanf( "%s ",&(pitem[pos].amark[0].schoolname));
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define maxsize 20
typedef struct mark{
char schoolname[10];
int score;
}Mark;
typedef struct item {
char itemname[10];
int itnum; //项目编号
char itsex; //项目类男,女
Mark amark[3];
}Item;
typedef struct school{
char schoolname[10];
int schoolnumber;
int score;
int mscore;
int wscore;
}School;
int menu(){
int selection=0;
printf( "==============================================\n ");
printf( "退出重新选择请重新输入(0):\n ");
printf( "要按学校编号输出请输入(1):\n ");
printf( "要按学校总分排序输出请输入(2):\n ");
printf( "要按男子团体总分排序输出请输入(3):\n ");
printf( "要按女子团体总分排序输出请输入(4):\n ");
printf( "要查询指定学校的指定项目请输入(5):\n ");
printf( "要按项目编号查询取得前三的学校请输入(6):\n ");
printf( "要输入新项目请输入(7):\n ");
scanf( "%d ",& selection );
getchar();// 吃掉回车
if(selection > =0 && selection <=7)
return selection;
else{
printf( "您选择的选择有误,请重新输入!\n ");
return -1;
}
}
void copy_schoolname(School *as,Item *pitem ,int i1,int j1, int ns1){
int j;
j=0;
// printf( "%s ",pitem[i1].amark[j1].schoolname);
printf( "%d%d%d ",i1,j1,ns1);
while(pitem[i1].itemname[j]!= '\0 '){
as[ns1].schoolname[j]=pitem[i1].amark[j1].schoolname[j];
j++;
}
printf( "%s ",as[ns1].schoolname);
}
int input_to_computer(Item *pitem,int *pc){
int pos=0;
char sx;
printf( "请输入项目类别(男项目:m/女项目:w): \n ");
scanf( "%c ",&sx);
//scanf( "%c ",&sx);
while ((sx!= 'w ') && (sx!= 'W ') && (sx!= 'm ') && (sx!= 'M ')){
printf( "输入有误,请重输入!(男项目:m/女项目:w):\n ");
scanf( "%c ",&sx);
}
pos=pc[0]++;
pitem[pos].itsex=sx;
if ((sx== 'm ') || (sx== 'M ')){
pc[1]++;
}else{
pc[2]++;
}
printf( "请输入要存储的项目名: \n ");
scanf( "%s ",&(pitem[pos].itemname));
printf( "请输入第一名的学校的校名: \n ");
scanf( "%s ",&(pitem[pos].amark[0].schoolname));