乱了~~再发一遍
#include<iostream>
#include<string>
#include<fstream>
using namespace std;
#define MIN 5
class student
{
long num;
string name;
char sex;
float math;
float english;
float sport;
float Cplus;
float sum;
float ave;
public:
static int total;
public:
void Creat();
void Output();
};
int student::total=0;
void student::Creat()
{
cout<<"欢迎进入学生的信息建立系统!"<<endl;
cout<<"学号"<<"\t"<<"姓名"<<"\t"<<"性别"<<"\t"<<"高等数学"<<"\t"<<"英语"<<"\t"<<"大学体育"<<"\t"<<"C++面向程序设计"<<endl;
cin>>num>>name>>sex>>math>>english>>sport>>Cplus;
student::total++;
}
void student::Output()
{
cout<<"学号"<<"\t"<<"姓名"<<"\t"<<"性别"<<"\t"<<"高等数学"<<"\t"<<"英语"<<"\t"<<"大学体育"<<"\t"<<"C++面向程序设计"<<endl;
cout<<num<<"\t"<<name<<"\t"<<sex<<"\t"<<math<<"\t"<<"\t"<<english<<"\t"<<sport<<"\t"<<"\t"<<Cplus<<endl;
}
//主菜单
void welcome()
{
cout<<endl<<endl;
cout<<endl<<endl;
cout<<"\t 设计: ******************* "<<endl;
cout<<"\t***************************************************"<<endl;
cout<<"\t* 欢迎进入学生成绩管理系统 *"<<endl;
cout<<"\t* *"<<endl;
cout<<"\t* 1:输入 2:输出 3:查询 *"<<endl;
cout<<"\t* 4:修改 5:增加 6:保存 *"<<endl;
cout<<"\t* 7:统计 8:读取 9:退出 *"<<endl;
cout<<"\t****************************************************"<<endl;
cout<<endl;
cout<<"请选择你需要的选项:";
}
//主函数
int main()
{
student *stu=new student[MIN];
welcome();
int choic;
while(choic!=0)
{
cin>>choic;
switch(choic)
{
case 1:
int n;
cout<<"你想输入多少个学生的基本信息?"<<endl;
cin>>n;
int i;
for(i=0;i<n;i++)
{
if(student::total>MIN)
stu=(student *)realloc(stu,(student::total+1)*sizeof(stu));
stu[student::total].Creat();
}
break;
case 2:
for (i=0;i<student::total;i++)
stu.Output();
break;
case 3:
//根据学号查询某个学生的基本信息
//查询指定学号的学生的基本信息
return 0;
break;
case 4:
//根据学号修改某个学生的基本信息
//修改指定学号的学生的基本信息。
return 0;
break;
case 5:
//增加某个学生的基本信息
//增加一个学生的基本信息。
return 0;
break;
case 6:
//将所有的学生保存到文件stu.dat中
//将所有学生的信息保存到"stu.dat"文件中。
return 0;
break;
case 7:
//统计平均成绩为优秀(大于等于85分)的学生并给出基本信息
//统计并显示平均成绩大于等于85分的学生的基本信息。
return 0;
break;
case 8:
//从文件stu.dat中读取所有学生的基本信息
//从文件"stu.dat"读取所有学生的信息。
return 0;
break;
case 9:
//退出当前程序
default :cout<<"您的输入有误,请重试!\n";
}
}
return 0;
}