麻烦各位帮我改一下
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
int choose;
int i,n;
char press;
struct Student
{
int number;
string name;
float Math;
float English;
float C;
float sum;
}stu[50];
void input()
{
int n,i;
cout<<"请输入需录入的学生人数:";
cin>>n;
for(i=0;i<n;i++)
{
cout<<"请输入第"<<i+1<<"个学生的数据:"<<endl;
cout<<"学号:"<<' ';cin>>stu[i].number;
cout<<"姓名:"<<' ';cin>>stu[i].name;
cout<<"高等数学成绩:"<<' ';cin>>stu[i].Math;
cout<<"大学英语成绩:"<<' ';cin>>stu[i].English;
cout<<"C++语言成绩:"<<' ';cin>>stu[i].C;
stu[i].sum=stu[i].Math+stu[i].English+stu[i].C;
}
cout<<"完成,按“0”返回主界面"<<endl;
cin>>press;
switch(press)
{
case'0':break;
}
}
void operate()
{
void check();
void change();
void add();
void shanchu();
do
{
cout<<"\t\t学生成绩操作"<<endl<<"\n";
cout<<"\t\t 1. 学生成绩查询"<<endl<<"\n";
cout<<"\t\t 2. 学生成绩修改"<<endl<<"\n";
cout<<"\t\t 3. 学生成绩增加"<<endl<<"\n";
cout<<"\t\t 4. 学生成绩删除"<<endl<<"\n";
cout<<"\t\t 0. 返回至主页面"<<endl<<"\n";
cout<<"\t\t请输入0-4之间的任意一数字(仅限数字) "<<endl;
cout<<"输入:";
cin>>choose;
switch (choose)
{
case 1: check(); break;
case 2: change(); break;
case 3: add(); break;
case 4: shanchu(); break;
case 0: break;
default:cout<<"\t输入有误,请重新输入"<<endl; break;
}
}while(choose != 0);
choose++;
}
void check()
{
int a;
int flag1;
int back;
int prime(int a);
cout<<"请输入你需要查询的学生的学号:"<<endl;
cin>>a;
flag1=prime(a);
cout<<flag1;
if(flag1==1)
{ cout<<"学号:"<<stu[i].number<<endl;
cout<<"姓名:"<<stu[i].name<<endl;
cout<<"高等数学成绩:"<<stu[i].Math<<endl;
cout<<"英语成绩:"<<stu[i].English<<endl;
cout<<"C++成绩:"<<stu[i].C<<endl;
cout<<"总成绩:"<<stu[i].sum<<endl;
cout<<'\n'<<"信息查询完毕,输入0返回学生信息操作界面"<<endl;
}
else cout<<"你输入的学号不存在"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
}
void change()
{
int a,back;
int b;
char c;
float d,e,f,g;
cout<<"请输入要修改信息的学生的学号:"<<endl;
cin>>a;
for(i=0;i<n;i++)
{
if(a==stu[i].number)
{
cout<<"\t\t请选择您所需要修改的信息项: "<<endl<<"\n";
cout<<"\t\t 1. 学生学号 "<<endl<<"\n";
cout<<"\t\t 2. 学生姓名 "<<endl<<"\n";
cout<<"\t\t 3. 高等数学成绩 "<<endl<<"\n";
cout<<"\t\t 4. 英语成绩 "<<endl<<"\n";
cout<<"\t\t 5. C++成绩 "<<endl<<"\n";
cout<<"\t\t 6. 总成绩 "<<endl<<"\n";
cout<<"输入:";
cin>>choose;
switch(choose)
{
case 1:cout<<"请输入更新后的学号:";
cin>>b;
stu[i].number=b;
cout<<'\n'<<"信息更改完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
break;
case 2:cout<<"请输入更新后的姓名:";
cin>>c;
stu[i].name=c;
cout<<'\n'<<"信息更改完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
break;
case 3:cout<<"请输入更新后的高等数学成绩:";
cin>>d;
stu[i].Math=d;
cout<<'\n'<<"信息更改完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
break;
case 4:cout<<"请输入更新后的英语成绩:";
cin>>e;
stu[i].English=e;
cout<<'\n'<<"信息更改完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
break;
case 5:cout<<"请输入更新后的C++成绩:";
cin>>f;
stu[i].C=f;
cout<<'\n'<<"信息更改完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
break;
case 6:cout<<"请输入更新后的总成绩:";
cin>>g;
stu[i].sum=g;
cout<<'\n'<<"信息更改完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
break;
}
}
}
}
void add()
{
int back;
cout<<"请输入新增学生的信息"<<endl;
cout<<"学号:";
cin>>stu[n].number;
cout<<"姓名:";
cin>>stu[n].name;
cout<<"高等数学成绩:";
cin>>stu[n].Math;
cout<<"英语成绩:";
cin>>stu[n].English;
cout<<"C++成绩:";
cin>>stu[n].C;
stu[n].sum=stu[n].Math+stu[n].English+stu[n].C;
n=n+1;
cout<<'\n'<<"新学生信息增加完毕,输入0返回学生信息操作界面"<<endl;
cout<<"输入: ";
cin>>back;
switch(back)
{
case '0' : break;
}
}
void shanchu()
{
int j,k;
cout<<"请输入要删除的学生的学号:";
cin>>j;
for(i=0;i<n;i++)
{
if(j==stu[i].number)
{
for(k=j;k<n;k++)
{
stu[k]=stu[k+1];
}
n--;
}
else
cout<<"没有找到相应的学生";
}
}
void business()
{
void subject();
void all();
do
{
cout<<"\t\t学生成绩统计"<<endl<<"\n";
cout<<"\t\t 1. 单科成绩排名"<<endl<<"\n";
cout<<"\t\t 2. 总成绩排名"<<endl<<"\n";
cout<<"\t\t 0. 返回至主页面"<<endl<<"\n";
cout<<"\t\t请输入0-2之间的任意一数字(仅限数字) "<<endl;
cout<<"输入:";
cin>>choose;
switch (choose)
{
case 1: subject(); break;
case 2: all(); break;
case 0: break;
default:cout<<"\t输入有误,请重新输入"<<endl; break;
}
}while(choose != 0);
choose++;
}
void subject()
{
do
{
cout<<"\t\t单科成绩排名"<<endl<<"\n";
cout<<"\t\t 1. 高等数学"<<endl<<"\n";
cout<<"\t\t 2. 英语"<<endl<<"\n";
cout<<"\t\t 3. C++"<<endl<<"\n";
cout<<"\t\t 0. 返回至主页面"<<endl<<"\n";
cout<<"\t\t请输入0-3之间的任意一数字(仅限数字) "<<endl;
cout<<"输入:";
cin>>choose;
switch (choose)
{
case 1:
for(i=0;i<n;i++)
{
cout<<"学号:"<<stu[i].number<<"姓名:"<<stu[i].name<<endl;
cout<<"高等数学成绩:"<<stu[i].Math;
}
break;
case 2:
for(i=0;i<n;i++)
{
cout<<"学号:"<<stu[i].number<<"姓名:"<<stu[i].name<<endl;
cout<<"英语成绩:"<<stu[i].English;
}
break;
case 3:
for(i=0;i<n;i++)
{
cout<<"学号:"<<stu[i].number<<"姓名:"<<stu[i].name<<endl;
cout<<"C++成绩:"<<stu[i].C;
}
break;
case 0: break;
default:cout<<"\t输入有误,请重新输入"<<endl; break;
}
}while(choose != 0);
choose++;
}
void all()
{
cout<<"总成绩排名为:"<<endl;
cout<<"学号:"<<stu[i].number<<"姓名:"<<stu[i].name<<endl;
cout<<"总分:"<<stu[i].sum;
}
void Exit()
{
cout<<"\t *谢谢使用该系统* "<<endl;
}
void main()
{int prime(int a);
do{
cout<<"\n\t\t 学 生 成 绩 管 理 系 统 "<<endl<<"\n";
cout<<"\t\t 1. 学生成绩录入 "<<endl<<"\n";
cout<<"\t\t 2. 学生成绩操作 "<<endl<<"\n";
cout<<"\t\t 3. 学生成绩统计 "<<endl<<"\n";
cout<<"\t\t 0. 退出系统 "<<endl<<"\n";
cout<<"\t\t 请输入0-3之间的任意一数字(仅限数字) "<<endl;
cout<<"输入: ";
cin>>choose;
switch(choose)
{
case 1: input(); break;
case 2: operate(); break;
case 3: business(); break;
case 0: Exit(); break;
default:cout<<"\t对不起,输入有误"<<endl;break;
}
}while(choose!=0);
}
int prime(int a)
{int flag,i;
flag=1;
for(i=0;i<n;i++)
if(stu[i].number==a)
{ flag=0;
continue;
}
return flag;
}