学生成绩管理系统代码
#include #include #include #include #include #include #include using namespace std; class Student { public: string number; string name; string math,english,computer; public: Student(string nu=“0“,string na=“0“,string ma=“0“,string en=“0“,string co=“0“); void setstudent(string Nu,stringNa,stringMa,stringen,string co); void setmath(string ma){math=ma;} void setenglish(string en){english=en;} void setcomputer(string eo){computer=eo;} bool search(string num){return number==num;} void display(); }; Student::Student(string nu,stringna,stringma,stringen,string co) { number = nu; name = na; math = ma; english = en; computer = co; } void Student::setstudent(string Nu,stringNa,stringMa,stringEn,string Co) { number = Nu; name = Na; math = Ma; english = En; computer = Co; } void Student::display() { couts.name; couts.english; coutnum; for(int j=0;jnu; for(int j=0;jnu; for(int j=0;jmaenco; stu[j].math=ma; stu[j].english=en; stu[j].computer=co; coutnunamaenco) { Student temp(nu,na,ma,en,co); stu.push_back(temp); } infile.close(); } void Manage:: Play() { cout“学号“setw(6)“姓名“setw(6)“数学“setw(6)“英语“setw(8)“计算机 “endl; for(inti=0;istu.size();i++) stu[i].display(); } void Manage::sum() { for(inti=0;istu.size();i++) { coutstu[i].name“的总分是:“; } } /* void Manage::ave() { } */ int main() { Student s; Manage m; m.Load(); char way; string ma,en,co; while(1) { system(“cls“); cout“******学生成绩管理系统*******“; cout“\n1.添加学生信息“; cout“\n2.修改学生信息“; cout“\n3.根据学生学号删除学生信息“; cout“\n4.计算每位学生总分“; cout“\n5.计算每位学生平均分“; cout“\n6.根据学生学号查询学生成绩信息“; cout“\n7.学生成绩排序“; cout“\n8.退出“; cout“\n***********************************“; cout“\n 请输入您的选择:“; way = getchar(); system(“cls“);//清屏 switch(way) { case 1 :m.Add(s);break; case 2 :m.Alter(ma,en,co);break; case 3 :m.Delete();break; case 4 :m.sum();break; case 5 ://m.ave();break; case 6 :m.Seek();break; case 7 : case 0 :m.Store();return 0;break; default:continue; } cout“\n\t\t 按回车键继续!“; getchar(); getchar(); } return 0; }