【C语言程序设计】学生成绩管理系统。不要框架 要全代码!!!谢谢了

2024-11-28 06:48:19
推荐回答(2个)
回答(1):

#include
#include
#include
#include
#define MY1 printf("学号\t姓名\t性别\t年龄\t生日")
#define MY2 printf("\n%d %6s %4s\t%2d %8d%2d%2d \n",s[i].num,s[i].name,s[i].sex,s[i].age,s[i].a.year,s
[i].a.month,s[i].a.day)
#define MY3 printf("家庭住址 联系方式 高数 英语 大物 总成绩")
#define MY4 printf("\n%4s %4s %2d %2d %2d %2d\n",s[i].address,s[i].tel,s[i].c.gao,s[i].c.ying,s
[i].c.wu,s[i].c.total)
#define MAX 30
int i;
int sum;
/*时间结构体类型*/
struct date
{
int year;
int month;
int day;
}a;
/*学生成绩结构体类型*/
struct score
{
int gao;
int ying;
int wu;
int total;
}c;
/*学生信息结构体类型*/
struct s_message
{
int num;
char name[20];
char sex[5];
int age;
struct date a;
char address[50];
char tel [11];
struct score c;
}s[MAX];
/*保存学生信息模块*/
void save_message(int sum)
{
int i;
FILE*fp;
if((fp=fopen("D:\\s.txt","wb"))==NULL)
{
printf("reading file is wrong!\n");
return;
}
for (i=0;i {
if(fwrite(&s[i],sizeof(struct s_message),1,fp)!=1)
printf("writing file is wrong!\n");
}
fclose(fp);
}
/*读取学生信息模块*/
int read_message()
{
FILE *fp;
int i=0;
if((fp=fopen("D:\\s.txt","rb"))==NULL)
{
printf("\n\n***********暂时无任何库存信息,按回车键进入主菜单选择基本信息的录入!***********\n");
return 0 ;
}
while(feof(fp)==0)
{
if(fread(&s[i],sizeof(struct s_message),1,fp)!=1) break;
i++;
}
fclose(fp);
return(i);

}
/*输入学生信息模块*/
putin_message()
{system("cls");
int i=0,m=0;
printf("\n\n***********输入学生信息****************\n\n");
printf("输入要输入的学生的个数(m scanf("%d",&m);
for(i=sum;i { printf("\n\n第%d个学生的信息\n",i+1);
printf("\n 学生学号:");
scanf("%d",&s[i].num);
if(s[i].num==0) break;
printf("\n 学生姓名:");
scanf("%s",s[i].name);
printf("\n 学生性别:");
scanf("%s",s[i].sex);
printf("\n 学生年龄:");
scanf("%d",&s[i].age);
printf("\n 学生生日:");
scanf("%d%d%d",&s[i].a.year,&s[i].a.month,&s[i].a.day);
printf("\n 家庭住址:");
scanf("%s",s[i].address);
printf("\n 联系方式:");
scanf("%s",s[i].tel);
printf("\n 高数--英语--大物(成绩0-100):");
scanf("%d%d%d",&s[i].c.gao,&s[i].c.ying,&s[i].c.wu);
s[i].c.total=s[i].c.gao+s[i].c.ying+s[i].c.wu;
flushall();
}
printf("\n***********************学生信息输入完毕**********************\n");
sum+=m;
printf("\n 按回车键返回主菜单!");
getch();
return 0;
}
/*输出学生信息模块*/
void putout_message()
{system("cls");
int i=0;
printf("\n*****************************学生信息表**********************\n\n");
for(i=0;i {
MY1;
MY2;
MY3;
MY4;
printf("\n\n");
}
printf("按回车键返回主菜单!");
getch();
}
/*添加学生信息*/
insert_message()
{system("cls");
int i=sum,flag=0;
char choice;
printf("\n\n**********添加一个学生信息***********\n");
do
{
printf("\n 学生学号:");
scanf("%d",&s[i].num);
if(s[i].num==0) break;
printf("\n 学生姓名:");
fflush(stdin);
scanf("%s",s[i].name);
printf("\n 学生性别:");
scanf("%s",s[i].sex);
printf("\n 学生年龄:");
scanf("%d",&s[i].age);
printf("\n 学生生日:");
scanf("%d %d %d",&s[i].a.year,&s[i].a.month,&s[i].a.day);
printf("\n 学生家庭住址:");
scanf("%s",s[i].address);
printf("\n 联系方式:");
scanf("%s",s[i].tel);
printf("\n 高数--英语--大物(成绩0-100):");
scanf("%d%d%d",&s[i].c.gao,&s[i].c.ying,&s[i].c.wu);
s[i].c.total=s[i].c.gao+s[i].c.ying+s[i].c.wu;
sum++;
printf("\n 要继续吗? (Y/N)");
choice=getch();
if(choice=='y'||choice=='Y')
{
printf("\n 继续!\n");
i++;
flag=1;
}
else flag=0;
}while(flag==1);
printf(" 按回车键返回主菜单!");
getch();
return 0;
}
/*修改学生信息*/
revise_message()
{system("cls");
int i=0,choice1;
int revise_num,flag=0;
int r=0;
char choice2;
printf("\n 输入要修改的学生的学号:");
scanf("%d",&revise_num);
for(i=0;i {
if(revise_num==s[i].num)
r=1;
}
if(r==0||revise_num==0)
printf("没有该学生的相关信息");
do
{
for(i=0;i {
if(s[i].num==revise_num)
{

printf("\n 你要修改哪一项?\n");
printf("\n 1.学号\n");
printf("\n 2.姓名\n");
printf("\n 3.性别\n");
printf("\n 4.年龄\n");
printf("\n 5.生日\n");
printf("\n 6.家庭住址\n");
printf("\n 7.联系方式\n");
printf("\n 8.高数--英语--大物--总成绩\n");
printf("请选择:");
scanf("%d",&choice1);
switch(choice1)
{
case 1: printf("\n 输入修改后的学生学号:");
scanf("%d",&s[i].num);break;
case 2: printf("\n 输入修改后的学生姓名:");
scanf("%s",s[i].name);break;
case 3: printf("\n 输入修改后的学生性别:");
scanf("%s",s[i].sex);break;
case 4: printf("\n 输入修改后的学生年龄:");
scanf("%d",&s[i].age);break;
case 5: printf("\n 输入修改后的学生生日:");
scanf("%d%d%d",&s[i].a.year,&s[i].a.month,&s[i].a.day);break;
case 6: printf("\n 输入修改后的学生家庭住址:");
scanf("%s",s[i].address);break;
case 7: printf("\n 输入修改后的联系方式:");
scanf("%s",s[i].tel);break;
case 8: printf("\n 输入修改后的高数--英语--大物(成绩0-100):");
scanf("%d%d%d",&s[i].c.gao,&s[i].c.ying,&s[i].c.wu);break;
}
}
}
printf("\n 要继续吗?(Y/N)");
choice2=getch();
if(choice2=='y'||choice2=='Y')
{
printf("\n 继续!\n");
flag=1;
}
else flag=0;
}while(flag==1);
printf(" 按回车键返回主菜单!");
getch();
return 0;
}
/*更新学生信息模块*/
renew_message()
{system("cls");
int choice;
do
{
printf("\n\n\n*****************更新学生信息*******************\n\n");
printf(" 1.添加学生信息\n\n");
printf(" 2.修改学生信息\n\n");
printf(" 0.返回主菜单\n\n");
printf(" choice(0-2)");
scanf("%d",&choice);
switch(choice)
{
case 1:insert_message();break;
case 2:revise_message();break;
case 0:break;
}
}while(choice!=0);
return 0;
}
/*按学号查询*/
int inquire_num()
{system("cls");
int i=0,j,r=0;
printf("\n 输入要查询的学生的学号:");
scanf("%d",&j);
for(i=0;i {
if(j==s[i].num)
r=1;
}
if(r==0||j==0)
printf("没有该学生的相关信息");
for(i=0;i if(j==s[i].num)
{
printf("\n **********学生信息**********\n");
MY1;
MY2;
MY3;
MY4;
}
getch();
return 0;
}
/*按姓名查询*/
int inquire_name()
{system("cls");
int i=0,r=0;
char inquire_name[20];
printf("\n 输入要查询的学生的姓名:");
scanf("%s",inquire_name);
for(i=0;i {
if(strcmp(s[i].name,inquire_name)==0)
r=1;
}
if(r==0)
printf("无该学生信息!!!\n");
for(i=0;i if(strcmp(s[i].name,inquire_name)==0)
{
printf("\n **********学生信息**********\n");
MY1;
MY2;
MY3;
MY4;
}
getch();
return 0;
}
/*查询高数成绩及格的学生*/
int inquire_gao()
{system("cls");
int i=0,j=0;
int x=60;
printf("\n ***高数成绩及格的学生的信息***\n");
for(i=0;i if(s[i].c.gao>=x)
{
MY1;
MY2;
MY3;
MY4;
j++;
}
if(j==0)
printf("无高数成绩及格的学生!!!!\n");
getch();
return 0;
}
/*查询英语成绩及格的学生*/
int inquire_ying()
{system("cls");
int i=0,j=0;
int x=60;
printf("\n ***英语成绩及格的学生的信息***\n");
for(i=0;i if(s[i].c.ying>=x)
{
MY1;
MY2;
MY3;
MY4;
j++;
}
if(j==0)
printf("无英语成绩及格的学生!!!!\n");
getch();
return 0;
}
/*查询大学物理成绩及格的学生*/
int inquire_wu()
{system("cls");
int i=0,j=0;
int x=60;
printf("\n ***大学物理成绩及格的学生的信息***\n");
for(i=0;i if(s[i].c.wu>=x)
{
MY1;
MY2;
MY3;
MY4;
j++;
}
if(j==0)
printf("无物理成绩及格的学生!!!!\n");
getch();
return 0;
}
/*查询各门成绩及格的学生*/
int inquire_jige()
{system("cls");
int choice;
do
{
printf("\n\n********查询学生信息*********\n\n");
printf(" 1.查询高数成绩及格的学生\n\n");
printf(" 2.查询英语成绩及格的学生\n\n");
printf(" 3.查询大学物理成绩及格的学生\n\n");
printf(" 0.返回主菜单\n\n");
printf(" choice(0-3)\n\n");
scanf("%d",&choice);
switch(choice)
{
case 1: inquire_gao();break;
case 2: inquire_ying();break;
case 3: inquire_wu();break;
case 0: break;
}
}while(choice!=0);
getch();
return 0;
}
/*查询学生信息模块*/
inquire_message()
{system("cls");
int choice;
do
{
printf("\n\n\n********查询学生信息*********\n\n");
printf(" 1.按学号查询\n\n");
printf(" 2.按姓名查询\n\n");
printf(" 3.查询各门成绩及格的学生\n\n");
printf(" 0.返回主菜单\n\n");
printf(" choice(0-3)\n\n");
scanf("%d",&choice);
switch(choice)
{
case 1: inquire_num();break;
case 2: inquire_name();break;
case 3: inquire_jige();break;
case 0: break;
}

}while(choice!=0);
getch();
return 0;
}
/*按学号排名*/
int rank_num()
{ system("cls");
int i=0,j;
struct s_message t;
for(i=0;i {
for(j=i+1;j {
if(s[i].num>s[j].num)
{
t=s[j];
s[j]=s[i];
s[i]=t;
}
}
}
printf(" 从学号小到大排列:\n");
for(i=0;i {
MY1;
MY2;
MY3;
MY4;
}
getch();
return 0;
}
/*按成绩排名*/
int rank_score()
{ system("cls");
int i=0,j;
struct s_message t;
for(i=0;i {
for(j=i+1;j {
if(s[i].c.total {
t=s[j];
s[j]=s[i];
s[i]=t;
}
}
}
printf(" 从成绩高到低排列:\n");
for(i=0;i {
MY1;
MY2;
MY3;
MY4;
}
getch();
return 0;
}
/*学生排名信息模块*/
int rank_message()
{ system("cls");
int choice;
do
{
printf("\n\n\n***********排名信息************\n\n");
printf(" 1.按学号排名\n\n");
printf(" 2.按成绩排名\n\n");
printf(" 0.返回主菜单\n\n");
printf(" choice(0-2)");
scanf("%d",&choice);
switch(choice)
{
case 1:rank_num();break;
case 2:rank_score();break;
case 0:break;
}
}while(choice!=0);
return 0;
}
/*统计男女学生的信息*/
int count_nn()
{system("cls");
int i=0,j=0;
char k[5];
printf("\n 输入要统计的学生的性别:");
scanf("%s",k);
printf("\n********** %s的学生的信息 **********\n",k);
for(i=0;i {
if(strcmp(s[i].sex,k)==0)
{
MY1;
MY2;
MY3;
MY4;
j++;
}
}
printf("统计%s的人数是:%d",k,j);
getch();
return 0;
}
/*按学号删除*/
int del_num()
{system("cls");
int i=0,m=0,k=0,flag;
char choice;
char de_num;
do
{
printf("\n 输入要删除的学生的学号:");
scanf("%d",&de_num);
for(i=0;i {
if(s[i].num!=de_num);
else break;
}
for(i=0;i {
if(s[i].num==de_num)
{
m=i;
for(i=m+1;i s[i-1]=s[i];
}
}
sum--;
printf("\n 此学生的信息已被删除**********\n");
printf("\n 要继续删除吗?(Y/N)");
choice=getch();
if(choice=='y'||choice=='Y')
{
printf("\n 继续!\n");
k++;
flag=1;
}
else flag=0;
}while(flag==1);
printf(" 按任意键返回主菜单!");
getch();
return 0;
}
/*按姓名删除*/
int del_name()
{system("cls");
int i=0,m=0,k=0,flag;
char choice;
char de_name[20];
do
{
printf("\n 输入要删除的学生的姓名:");
scanf("%s",&de_name);
for(i=0;i {
if(strcmp(s[i].name,de_name)!=0);
else break;
}
for(i=0;i {
if(strcmp(s[i].name,de_name)==0)
{
m=i;
for(i=m+1;i s[i-1]=s[i];
}
}
sum=sum-1;
printf("\n 此学生的信息已被删除**********\n");
printf("\n 要继续删除吗?(Y/N)");
choice=getch();
if(choice=='y'||choice=='Y')
{
printf("\n 继续!\n");
k++;
flag=1;
}
else flag=0;
}while(flag==1);
printf(" 按任意键返回主菜单!");
getch();
return 0;
}
/*删除学生信息模块*/
del_message()
{system("cls");
int choice;
do
{
printf("\n\n\n*****删除学生信息*****\n\n");
printf(" 1.按学号删除\n\n");
printf(" 2.按姓名删除\n\n");
printf(" 0.返回主菜单\n\n");
printf(" choice(0-2)");
scanf("%d",&choice);
switch(choice)
{
case 1:del_num();break;
case 2:del_name();break;
case 0:break;
}

}while(choice!=0);
getchar();
return 0;
}
/*主函数*/
void main()
{system("cls");
int choice,m;
sum=read_message();
char a[4]="110",b[4];
printf("\n\n\n**********************************请您输入密码**********************************\n");
printf("密码:");
for(m=0;m<3;m++)
{ b[m]=getch();
printf("*");
}
b[3]='\0';
getch();
if(strcmp(a,b)==0)
{
do
{
printf
("\n\n********************************************************************************\n");
printf("\n\n************密码输入成功欢迎您进入学生信息管理系统
******************************\n\n");
printf("********************************************************************************\n");
printf(" 1.录入学生信息\n\n");
printf(" 2.输出学生信息\n\n");
printf(" 3.更新学生信息\n\n");
printf(" 4.查询学生信息\n\n");
printf(" 5.学生排名信息\n\n");
printf(" 6.统计学生信息\n\n");
printf(" 7.删除学生信息\n\n");
printf(" 0.退出系统\n\n");
printf(" 请选择(0-7):");
scanf("%d",&choice);
switch(choice)
{
case 1: putin_message();save_message(sum);break;
case 2: putout_message();break;
case 3: renew_message();break;
case 4: inquire_message();break;
case 5: rank_message();break;
case 6: count_nn();break;
case 7: del_message();break;
case 0: break;
}
}while(choice!=0);
save_message(sum);
printf("学籍信息被保存!--(s.txt)\n");
}
}

回答(2):

#include
#include
#include
/********定义学生结构体********/
typedef struct Link
{
int number;
char name[10];
char sex[4];
int Chinese;
int English;
int Match;
float average;
struct Link *next;
}Student;
int amount=0;;//记录学生个数
/*****************************/
/***********初始化学生表*************/
Student *InitStudent()
{
Student *Q;
Q=(Student*)malloc(sizeof(Student));
if(Q!=NULL)
{
Q->next=NULL;
return Q;
}
else
return NULL;
}
/***********************************/
/**************创建学生数据表*********************/
int CreatStudent(Student *Q)
{
int flag,n;
Student *s;
n=0;
while(flag)
{
s=(Student*)malloc(sizeof(Student));
if(s==NULL)
{
printf("创建失败!");
return 0;
}
printf("请输入学号(输入0退回上一步):");
scanf("%d",&s->number);
if(s->number==0)
goto endp;
if(n==s->number)
{
printf("输入学号已存在!\n");
goto end;
}
while(s->number<0)
{
getchar();
printf("\n学号不能为小于零!");
printf("\n请输入学号,输入0退回上一步:");
scanf("%d",&s->number);
}
printf("请输入姓名:");
scanf("%s",s->name);
printf("请输入性别m/w:");
scanf("%s",s->sex);
printf("请输入语文成绩:");
scanf("%d",&s->Chinese);
while(s->Chinese>100||s->Chinese<0)
{
getchar();
printf("请输入语文成绩:");
scanf("%d",&s->Chinese);
}
printf("请输入数学成绩:");
scanf("%d",&s->Match);
while(s->Match>100||s->Match<0)
{
getchar();
printf("请输入数学成绩:");
scanf("%d",&s->Match);
}
printf("请输入英语成绩:");
scanf("%d",&s->English);
while(s->English>100||s->English<0)
{
getchar();
printf("请输入英语成绩:");
scanf("%d",&s->English);
}
s->average=(s->Chinese+s->English+s->Match)/3;
n=s->number;
s->next=Q->next;
Q->next=s;
amount++;
end: printf("是否继续输入数据:1/0\n");
scanf("%d",&flag);

}
endp:printf("创建完毕!\n");
printf("输入了%d个学生",amount);
return 1;
}
/******************************************/
/*********************查找学生数据,以学号为前提****************/
Student *FindStudent(Student *Q,int x)
{

Student *q;
q=Q->next;
while(q!=NULL&&q->number!=x)
q=q->next;
if(q!=NULL)
return q;
else
return NULL;
}
/******************************************************/
/**************************修改学生数据**************************/
int ModifStudent(Student *Q,int x)
{
int flag,n;
Student *q;
q=Q->next;
while(q!=NULL&&q->number!=x)
q=q->next;
if(q!=NULL)
{
while(n)
{
printf("\n修改成绩科目:1.语文 2.英语 3.数学:");
scanf("%d",&flag);
if(flag==1)
{
getchar();
printf("\n请输入语文成绩:");
scanf("%d",&q->Chinese);
while(q->Chinese>100||q->Chinese<0)
{
getchar();
printf("\n请输入语文成绩:");
scanf("%d",&q->Chinese);
}
}
else if(flag==2)
{

getchar();
printf("\n请输入数学成绩:");
scanf("%d",&q->Match);
while(q->Match>100||q->Match<0)
{
getchar();
printf("\n请重新输入数学成绩:");
scanf("%d",&q->Match);
}
}
else if(flag==3)
{
getchar();
printf("\n请输入英语成绩:");
scanf("%d",&q->English);
while(q->English>100||q->English<0)
{
printf("\n请重新英语成绩:");
scanf("%d",&q->English);
}
}
q->average=(q->Chinese+q->English+q->Match)/3;
printf("\n是否继续修改数据:1/0\n");
scanf("%d",&n);
}

return 1;
}

return 0;
}
/******************************************************/
/************************排列学生数据***********************/
Student *Sort(Student *Q,int course)
{

Student *p,*q,*t;
int number,Chinese,English,Match,score;
char name[10],sex[2];
if(Q->next==NULL)
{
printf("没有构造学生表!");
return NULL;
}
switch(course)
{
case 1:for(p=Q->next;p;p=p->next)
{
t=p;
for(q=Q->next;q;q=q->next)
{
if(t->Chinese>=q->Chinese)
{
number=t->number;
Chinese=t->Chinese;
English=t->English;
Match=t->Match;
score=t->average;
t->number=q->number;
t->Chinese=q->Chinese;
t->English=q->English;
t->Match=q->Match;
t->average=q->average;
q->number=number;
q->Chinese=Chinese;
q->English=English;
q->Match=Match;
q->average=score;
strcpy(name,t->name);
strcpy(sex,t->sex);
strcpy(t->name,q->name);
strcpy(t->sex,q->sex);
strcpy(q->name,name);
strcpy(q->sex,sex);
t=q;
}
}
}
break;
case 2:for(p=Q->next;p;p=p->next)
{
t=p;
for(q=Q->next;q;q=q->next)
{
if(t->English>=q->English)
{
number=t->number;
Chinese=t->Chinese;
English=t->English;
Match=t->Match;
score=t->average;
t->number=q->number;
t->Chinese=q->Chinese;
t->English=q->English;
t->Match=q->Match;
t->average=q->average;
q->number=number;
q->Chinese=Chinese;
q->English=English;
q->Match=Match;
q->average=score;
strcpy(name,t->name);
strcpy(sex,t->sex);
strcpy(t->name,q->name);
strcpy(t->sex,q->sex);
strcpy(q->name,name);
strcpy(q->sex,sex);
t=q;
}
}
}
break;
case 3:for(p=Q->next;p;p=p->next)
{
t=p;
for(q=Q->next;q;q=q->next)
{
if(t->Match>=q->Match)
{
number=t->number;
Chinese=t->Chinese;
English=t->English;
Match=t->Match;
score=t->average;
t->number=q->number;
t->Chinese=q->Chinese;
t->English=q->English;
t->Match=q->Match;
t->average=q->average;
q->number=number;
q->Chinese=Chinese;
q->English=English;
q->Match=Match;
q->average=score;
strcpy(name,t->name);
strcpy(sex,t->sex);
strcpy(t->name,q->name);
strcpy(t->sex,q->sex);
strcpy(q->name,name);
strcpy(q->sex,sex);
t=q;
}
}
}
break;

}
return Q;

}
int SaveStudent(Student *Q)
{
int i=0;
Student *p;
FILE *fp;
char open[20];
p=Q->next;
printf("请输入文件路径:");
scanf("%s",open);
if((fp=fopen(open,"w+"))==NULL)
{
printf("打开失败!");
return 0;
}
fprintf(fp,"|学号\t|姓名\t|性别\t|语文\t|英语\t|数学\t|均分\t|\n");

while(p!=NULL&&i {
i++;
fwrite(p,sizeof(Student),1,fp);
p=p->next;
//fprintf(fp,"|%d\t|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",p->number,p->name,p->sex,p->Chinese,p->English,p->Match,p->average);
}
fclose(fp);
return 1;
}

/******************************************************************/
/************************输出学生成绩*******************************************/
void print(Student *Q)
{
Student *p;
p=Q;
if(Q->next==NULL)
printf("没有学生资料!");
else
{
printf("结果为:\n");
while(p->next!=NULL)
{
p=p->next;

printf("|学号\t|姓名\t|性别\t|语文\t|英语\t|数学\t|均分\t|\n");
printf("|%d\t|%s\t|%s\t|%d\t|%d\t|%d\t|%0.2f\t|\n",p->number,p->name,p->sex,p->Chinese,p->English,p->Match,p->average);

}
}

}
/********************************************************************************/
/********************************************************************************/
void LoadStudent()
{
int flag=1;
char FileName[20];
Student *p;
FILE *fp;
printf("请输入调出文件的路径:");
scanf("%s",FileName[20]);
if((fp=fopen(FileName,"r+"))!=NULL)
{
fscanf(fp,"|学号\t|姓名\t|性别\t|语文\t|英语\t|数学\t|均分\t|\n");
printf("|学号\t|姓名\t|性别\t|语文\t|英语\t|数学\t|均分\t|\n");
while(flag)
{
p=(Student*)malloc(sizeof(Student));
fscanf(fp,"%d%s%s%d%d%d%d",&p->number,p->name,p->sex,&p->Chinese,&p->English,&p->Match,&p->average);
if(p->number==NULL)
flag=0;
else
{
printf("|%d\t|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",p->number,p->name,p->sex,p->Chinese,p->English,p->Match,p->average);
flag=1;
}
}

}
else
printf("调出失败!");
fclose(fp);

}
/***************************************菜单界面********************************/
void Menu()
{
int flag,n,sure,course;
Student *Q,*p,*L;
n=0;
Q=InitStudent();
begin:
printf("\n\t\t\t 学生管理系统(可输入汉字)\n");
printf("|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|\n");
printf("|1输入学生数据\t\t\t2修改学生数据\t\t\t3查找学生成绩|\n");
printf("|4排列学生数据\t\t\t5保存学生成绩\t\t\t6调出文件资料|\n");
printf("|7显示学生资料\t\t\t0结束程序 \t\t\t |\n");
printf("|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|\n");
printf("\n操作方式:");
scanf("%d",&flag);
switch(flag)
{
case 0:goto end;break;
case 1:CreatStudent(Q);
print(Q);
goto begin;
case 2:while(n==0)
{
printf("请输入查找学生学号:");
scanf("%d",&n);
}
sure=ModifStudent(Q,n);
if(sure==1)
printf("修改成功\n");
else
printf("修改失败\n");
n=0;
goto begin;
case 3:while(n==0)
{
printf("请输入查找学生学号:");
scanf("%d",&n);
}
p=FindStudent(Q,n);
if(p!=NULL)
{
printf("\n查询结果为:\n");
printf("|学号\t|姓名\t|性别\t|语文\t|英语\t|数学\t|均分\t|\n");
printf("|%d\t|%s\t|%s\t|%d\t|%d\t|%d\t|%d\t|\n",p->number,p->name,p->sex,p->Chinese,p->English,p->Match,p->average);
}
else
printf("查找失败\n");
n=0;
goto begin;

case 4:printf("请输入排序规则(输入0返回上一步)\n1.语文 2.英语 3.数学:");
scanf("%d",&course);
if(course==0)
goto begin;
else
{
L=Sort(Q,course);
if(L!=NULL)
print(L);
}
goto begin;
case 5:SaveStudent(Q);
goto begin;
case 6:LoadStudent();
goto begin;
case 7:print(Q);
goto begin;
}

end:printf("\n\t\t\t\t 学生管理系统\n");
printf("|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|\n");
printf("|1输入学生数据\t\t\t2修改学生数据\t\t\t3查找学生成绩|\n");
printf("|0退出程序\n");
printf("|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|\n");
}
/************************************结束*************************************/
/*****************************************************/
void main()
{
Menu();
}