```#include<iostream>
#include<iomanip>
using namespace std;
struct student
{
char no[15];
char name[20];
char sex;
int computer;
int math;
int english;
float average;
};
void print()//打印主菜单
{
cout<<"***********************\n";
cout<<" 学生成绩管理系统\n";
cout<<"***********************\n";
cout<<"\t.1记录成绩\n";
cout<<"\t.2查询成绩\n";
cout<<"\t.3修改成绩\n";
cout<<"\t.4成绩排名\n";
cout<<"\t.5计算平均分\n";
cout<<"\t.6查看所有成绩\n";
}
void Outputinformation(student a[],int n)//输出成绩表
{
int i;
cout<<left<<setw(15)<<"学号"<<"\t"<<setw(20)<<"姓名"<<"\t"//setw
<<setw(6)<<"性别"<<"\t"
<<setw(8)<<"C语言成绩"<<"\t"
<<setw(8)<<"微积分"<<"\t"
<<setw(8)<<"大学英语"<<"\t"
<<setw(8)<<"平均成绩"<<"\n";
for(i=0;i<6;i++)
{
cout<<left<<setw(15)<<a[i].no<<"\t";
cout<<setw(20)<<a[i].name<<"\t";
cout<<setw(6)<<a[i].sex<<"\t";
cout<<setw(8)<<a[i].computer<<"\t";
cout<<setw(8)<<a[i].math<<"\t";
cout<<setw(8)<<a[i].english<<"\t";
cout<<setw(8)<<a[i].average<<"\n";
}
}
int main()
{
print();
student stu[6]=
{
{"101","李马克",'m',0,0,0,0.0},
{"102","宋人头",'m',0,0,0,0.0},
{"103","西瓜",'f',0,0,0,0.0},
{"104","橙子",'f',0,0,0,0.0},
{"105","菠萝",'f',0,0,0,0.0},
{"106","胡图图",'m',0,0,0,0.0}
};
int choice;
cout<<"请输入你的选择:\n";
cin>>choice;
if(choice>6)
{
cout<<"!!谢谢使用!!*^*"<<endl;
}
else if(choice<=6&&choice>0)
{
switch(choice)
{
// case 1:Inputinformation(stu,5);//录入成绩
// break;
// case 2:search(stu,5);//调用查询函数
// break;
// case 3:stu_modify(stu,5);//修改成绩
// break;
// case 4:sort(stu,5);//成绩排序
// break;
// case 5:stu_average(stu,5);//平均成绩
// break;
case 6:Outputinformation(stu,5); //输出成绩
break;
}
}
}