当前位置:文档之家› 大学C++课程设计报告--学生成绩管理系统(附源代码)

大学C++课程设计报告--学生成绩管理系统(附源代码)

广东海洋大学课程设计报告课程名称:C/C++语言程序设计课程编号:@@学生姓名:陈@@学生班级:信管1071学号:实习地点:科技楼起止时间:2008.12.29-2009.01.02指导教师:@@一、目的与要求通过本课程设计的实践,全面总结C++课程学习中的的数据类型、程序结构、数组、函数、指针、结构体、链表等基本概念,掌握其使用方法。

掌握面向对象程序设计中有关类、对象、继承、重载、多态性、输入输出流类体系、文件操作的基本概念,初步学会用类与对象这种面向对象的程序设计方法编写应用程序。

培养使用面向对象的程序设计方法编写计算机程序的能力。

通过设计一个《学生成绩统计管理》,进一步熟悉C++中类的概念、类的封装、继承的实现方式。

了解系统开发的需求分析、类层次设计、模块分解、编码测试、模块组装与整体调试的全过程,加深对C++的理解与Visual C++环境的使用;逐步熟悉程序设计的方法,并养成良好的编程习惯。

程序设计是一门实践性很强的课程,必须十分重视实践环节。

许多实际的知识不是靠听课和看书学到的,而是通过长时间的实践积累的。

二、设计内容学生成绩管理系统1.基本功能:a)成绩的输入(学号、姓名、英语、数学、C++语言…);b)成绩统计(各科平均成绩、各科成绩“优秀”、“良好”、“中等”、“及格”、“不及格”的人数及其所占比例);c)总成绩统计(学生的总成绩、平均成绩及成绩排名)d)成绩的统计结果显示。

2.扩展功能:a)学生数据的添加、修改、与删除b)学生数据的读取与存储3.设计要求a)采用面向对象的思想和方法完成设计,最好能够基于windows图形界面。

b)至少设计四个类;学生类(描述学生基本信息);成绩类:班级类;课程类(描述课程信息:课程编号,科目名称(如高等数学,大学英语等);学生成绩及课程信息用文件保存,每个类一个文件,程序执行时从文件读入。

三、过程与结果主要内容如下:1.关键类的设计,继承层次关系,代码:首先,创建了一个student类.在student类的共有部分声明程序所需函数;然后就是student类的函数实现部分,其中定义student类的带参数及不带参数构造函数;再是常用函数的调用,并定义系统菜单函数及其界面;最后就是主函数文件。

Student类的声明如下:主要功能函数的设计:1.关于计算总成绩和平均成绩以及评定成绩等级的函数,而用于成绩统计中优秀、良好、中等、及格、不及格的计算,不过为便于表达,此程序采用字母A,B,C,D,E来分别表达上述等级;代码如下:2.此函数为查找函数的实现过程,通过while switch和if语句以及制表格和setw的使用将输入的数据以表格的形式打印出来,等级一栏宽度略小;3.此函数为删除函数的实现部分,巧妙运用字母i,定义i的值0为数据不存在,1为数据存在的情况,删除时考虑数据存在与否的问题;4.排序函数中分四种情况排序,分别按学号,总分,平均分来排序,排序结果也能有升序或降序操作,通过while else语句以及制表格和case的使用将输入的数据排序出来;因函数体过于庞大,在后面代码清单罗列出来时会标示出来。

数据输入设计:数据输入以输出方式打开文件,通过this指针和地址引用把写入的数据加在文件末尾;程序测试结果:1运行程序.会出现如下画面,按照提示进行选择.2.首先选择1,然后按Enter键.按照提示对学生情况进行输入.如图:3.按任意键程序自动保存第一个同学的数据,并返回菜单,按照刚才的步骤继续输入第二个、第三个同学等等的数据;4.选择4, 然后按Enter键.对数据进行进行有目的性的排序.如图:5.譬如选择2按总分排序,按Enter键,再在接下来的提示框中选择降序排序类型,再按一次Enter键,排序结果如图:符合设计要求,但各科成绩“优秀”、“良好”、“中等”、“及格”、“不及格”的人数及其所占比例因个人能力有限未能设计出来;6.按任意键又返回菜单,继续接下来的操作;四、设计总结这次课程设计基本上涵盖了大学一年级学习到的C++ 语言知识点,课程设计题目要求不仅要求对课本知识有较深刻的了解,同时要求程序设计者有较强的思维和动手能力。

这次课设使我了解我编程思想和编程技巧,也认识了软件生命周期的各个环境,包括构思、设计、编写、调试、发布、文档化、维护和修订。

C++程序编译是一种要求特别精细的工作,小到一个分号(或点)都能影响整个程序的运行,这就要求我们编写程序时要特别细心,即使是一个符号,还是一个字母都不能乱用。

在这次的编写过程中,我就因为错把case序列语句里的变量中的p写成q使整个程序瘫痪。

它让我记住了学习需要认真、仔细、负责的态度对待。

这次课程设计虽说很辛苦,而且设计出来的程序不全具备课程所需的,不过扩展功能学生数据的添加、修改、与删除的函数嵌进去,而且排序功能关联升序和降序功能,正所谓鱼与熊掌不可得兼。

这次课程设计,在整个程序中,我们通过使用while循环,switch语句,冒泡排序法,表格设计中的setw()以及类的定义及使用来完成程序设计,使我提高了对C++中语句的使用能力和组合能力,进一步加强了我对使用C++编程的能力。

还让我掌握了高级程序设计语言的基本思想、基本概念、基本方法和基本技能,while语句,this指针,case 作为程序的入口,一般结合switch使用等等。

一个星期以来的课程设计,感谢帮助我的同学和师长,通过和他们的交流,互相交流经验,我这次设计的程序中各大主函数体得以设计出来,感谢他们在我编程过程中为我做的提醒和指点,这真的很重要。

这次课程设计不仅让我修补了以前学习的漏洞,也让我知道一个道理:编程需要兴趣和实际动手。

这应该可以借鉴在同学或者师长们的编程经验上。

创新思维至关重要,相对于我这略感冗余却实现不了更多功能的程序来说,有必要写出精简的代码,也有助于开发出高效的程序。

虽说我编写的程序离专业人员设计的还有好大一段距离,但它已经是我目前的极限。

我相信,通过我的努力,在不久的将来,我会编出一组真正实用的程序的。

五、成绩评定成绩指导教师日期六、附件程序源代码清单:#include<iostream>#include<string>#include<fstream>#include<iomanip>using namespace std;class student{private:string number;string name;double computer;double English;double math;double sum;double ave;char grade;student *head;student *curnode;student *next;public:student();//不带参数的构造函数student(string ,string ,double ,double ,double ,double =0.0,double =0.0,char =NULL); //带数据域参数的构造函数,用来动态建立节点void sum_score();//总分函数void ave_score();//平均分函数void grade_score();//成绩等级void cin_app();//修改用void app_score(string ,string ,double ,double ,double); //动态的建立节点void del_score(); //删除全部节点void displist(); //输出节点中的全部数据void lookup(int ,string ); //查找函数void del_score(int ,string ); //删除函数void compositor(int ,int ); //排序函数void rework(int ,string ); //修改函数};//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////student类的实现void err_char();//输入错误字符检测函数void score_err();//成绩范围检测函数,当输入成绩不在0到100之间时提示重新输入student::student():next(NULL)//不带参数的构造函数{head=curnode=this;}//带参数的构造函数student::student(string Number,string Name,double Computer,double ENglish,double Math,double Sum,double Ave,char Grade):next(NULL){number=Number;name=Name;computer=Computer;English=ENglish;math=Math;sum=Sum;ave=Ave;grade=Grade;}void student::sum_score()///////////////////////计算总成绩{sum=computer+English+math;}void student::ave_score()/////////////////////计算平均成绩{ave=(computer+English+math)/3.0;}void student::grade_score()///////////////////计算成绩等级{int i;i=ave;switch(i/10){case 10: grade='A'; break;case 9: grade='A'; break;case 8: grade='B'; break;case 7: grade='C'; break;case 6: grade='D'; break;default: grade='E';}}void student::app_score(string Number,string Name,double Computer,double ENglish,double Math)//动态建立节点{curnode->next=new student(Number,Name,Computer,ENglish,Math);curnode=curnode->next;}void student::del_score()//////////////////////删除表中的全部数据{student *p;curnode=head->next;while(curnode!=NULL){p=curnode->next;delete curnode;curnode=p;}head->next=NULL;curnode=head;cout<<"┏━━━━━━━━━━━━━━━━━━━┓"<<endl;cout<<"┃!表中内容全部清空,现已是一个空表! ┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━━━━━┛"<<endl;cout<<" ";system("pause");}void student::displist()////////////////////////输出表中的全部数据{if(head->next==NULL){cout<<"┏━━━━━━━━━┓"<<endl;cout<<"┃!这是一个空表! ┃"<<endl;cout<<"┗━━━━━━━━━┛"<<endl;cout<<" ";system("pause");return;}student *pw=curnode;curnode=head->next;cout<<"┏━━━━━┳━━━━━┳━━━┳━━━┳━━━┳━━━━┳━━━━┳━━┓"<<endl;cout<<"┃学号┃姓名┃计算机┃英语┃数学┃总分┃平均分┃等级┃"<<endl;cout<<"┣━━━━━╋━━━━━╋━━━╋━━━╋━━━╋━━━━╋━━━━╋━━┫"<<endl;while(curnode!=NULL){cout<<"┃"<<left<<setw(10)<<curnode->number;cout<<"┃"<<left<<setw(10)<<curnode->name;cout<<"┃"<<left<<setw(6)<<curnode->computer;cout<<"┃"<<left<<setw(6)<<curnode->English;cout<<"┃"<<left<<setw(6)<<curnode->math;curnode->sum_score();cout<<"┃"<<left<<setw(8)<<curnode->sum;curnode->ave_score();cout<<"┃"<<left<<setw(8)<<curnode->ave;curnode->grade_score();cout<<"┃"<<left<<setw(4)<<curnode->grade<<"┃"<<endl;if(curnode->next!=NULL)cout<<"┣━━━━━╋━━━━━╋━━━╋━━━╋━━━╋━━━━╋━━━━╋━━┫"<<endl;elsecout<<"┗━━━━━┻━━━━━┻━━━┻━━━┻━━━┻━━━━┻━━━━┻━━┛"<<endl;curnode=curnode->next;}curnode=pw;cout<<"┏━━━━━━━━━┓"<<endl;cout<<"┃!表中内容输出完毕!┃"<<endl;cout<<"┗━━━━━━━━━┛"<<endl;cout<<" ";system("pause");}////////////////////////////////////////输入数据void student::cin_app(){student *p=curnode;bool b=0;string Number;string Name;double Computer;double ENglish;double Math;while(1){cout<<" 学号:";cin>>Number;curnode=head->next;while(curnode!=NULL){b=(Number==curnode->number);curnode=curnode->next;}if(!b)break;else{cout<<"┏━━━━━━━━━━━━━━┓"<<endl;cout<<"┃出现了相同的学号,请重新输入┃"<<endl;cout<<"┗━━━━━━━━━━━━━━┛"<<endl;}}curnode=p;cout<<" 姓名:";cin>>Name;while(1){cout<<" 计算机:";cin>>Computer;while(cin.fail()){err_char();cout<<" 计算机:";cin>>Computer;}if(Computer>=0&&Computer<=100)break;elsescore_err();}while(1){cout<<" 英语:";cin>>ENglish;while(cin.fail()){err_char();cout<<" 英语:";cin>>ENglish;}if(ENglish>=0&&ENglish<=100)break;elsescore_err();}while(1){cout<<" 数学:";cin>>Math;while(cin.fail()){err_char();cout<<" 数学:";cin>>Math;}if(Math>=0&&Math<=100)break;elsescore_err();}this->app_score(Number,Name,Computer,ENglish,Math);cout<<"┏━━━━━━━━┓"<<endl;cout<<"┃!已添加一条记录!┃"<<endl;cout<<"┗━━━━━━━━┛"<<endl;cout<<" ";system("pause");}//////////////////////////////////////////查找函数的实现void student::lookup(int n,string str){student *p=curnode;bool b;//定义i=1,当找到数据时把i置为0.用于输出没有找到数据int i=1;if(!(curnode=head->next)){cout<<"┏━━━━━━━┓"<<endl;cout<<"┃!这是一个空表!┃"<<endl;cout<<"┗━━━━━━━┛"<<endl;curnode=p;cout<<" ";system("pause");return;}cout<<"┏━━━━━┳━━━━━┳━━━┳━━━┳━━━┳━━━━┳━━━━┳━━┓"<<endl;cout<<"┃学号┃姓名┃计算机┃英语┃数学┃总分┃平均分┃等级┃"<<endl;cout<<"┣━━━━━╋━━━━━╋━━━╋━━━╋━━━╋━━━━╋━━━━╋━━┫"<<endl;while(curnode!=NULL){switch(n){case 1: b=curnode->number==str;break;case 2: b=curnode->name==str;break;default: return;}if(b){i=0;cout<<"┃"<<left<<setw(10)<<curnode->number;cout<<"┃"<<left<<setw(10)<<curnode->name;cout<<"┃"<<left<<setw(6)<<curnode->computer;cout<<"┃"<<left<<setw(6)<<curnode->English;cout<<"┃"<<left<<setw(6)<<curnode->math;curnode->sum_score();cout<<"┃"<<left<<setw(8)<<curnode->sum;curnode->ave_score();cout<<"┃"<<left<<setw(8)<<curnode->ave;curnode->grade_score();cout<<"┃"<<left<<setw(4)<<curnode->grade<<"┃"<<endl;cout<<"┣━━━━━╋━━━━━╋━━━╋━━━╋━━━╋━━━━╋━━━━╋━━┫"<<endl;}curnode=curnode->next;}//当i=1是代表没有找到数据if(i){cout<<"┣━━━━━┻━━━━━┻━━━┻━━━┻━━━┻━━━━┻━━━━┻━━┫"<<endl;cout<<"┃没有匹配的数据┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"<<endl;}elsecout<<"┗━━━━━┻━━━━━┻━━━┻━━━┻━━━┻━━━━┻━━━━┻━━┛"<<endl;curnode=p;cout<<" 以上是本次查找的结果!"<<endl;cout<<" ";system("pause");}//////////////////////////////////////////删除函数的实现void student::del_score(int n,string str){student *p=curnode,*pw=head;bool b;//定义i=1,当找到数据时把i置为0.用于输出没有找到数据int i=1;if(!(curnode=head->next)){cout<<"┏━━━━━━━┓"<<endl;cout<<"┃!这是一个空表!┃"<<endl;cout<<"┗━━━━━━━┛"<<endl;curnode=p;cout<<" ";system("pause");return;}while(curnode!=NULL){switch(n){case 1: b=curnode->number==str;break;case 2: b=curnode->name==str;break;default: return;}if(b){i=0;pw->next=curnode->next;delete curnode;curnode=pw->next;}else{pw=curnode;curnode=curnode->next;}}//当i=1是代表没有找到数据if(i){cout<<"┏━━━━━━━┓"<<endl;cout<<"┃没有匹配的数据┃"<<endl;cout<<"┗━━━━━━━┛"<<endl;}else{cout<<"┏━━━━━━━┓"<<endl;cout<<"┃数据删除成功┃"<<endl;cout<<"┗━━━━━━━┛"<<endl;}curnode=head;while(curnode->next){curnode=curnode->next;}cout<<" ";system("pause");}//////////////////////////////////////排序函数的实现void student::compositor(int n,int m){if(head->next==NULL){cout<<"┏━━━━━━━━━━━┓"<<endl;cout<<"┃!这是一个空表不能排序!┃"<<endl;cout<<"┗━━━━━━━━━━━┛"<<endl;cout<<" ";system("pause");return;}if(head->next->next==NULL){cout<<"┏━━━━━━━━━━━┓"<<endl;cout<<"┃!只有一条记录不用排序!┃"<<endl;cout<<"┗━━━━━━━━━━━┛"<<endl;cout<<" ";system("pause");return;}student *s,*p,*q,*r;r=head;s=head->next;q=s;p=q->next;while(s!=NULL){while(p!=NULL){switch(n){case 1:{if(m==1){while(s->number<p->number){q->next=p->next;r->next=p;p->next=s;s=p;p=q->next;if(p==NULL)break;}}else{while(s->number>p->number){q->next=p->next;r->next=p;p->next=s;s=p;p=q->next;if(p==NULL)break;}}break;}case 2:{if(m==1){while(s->sum<p->sum){q->next=p->next;r->next=p;p->next=s;s=p;p=q->next;if(p==NULL)break;}}else{while(s->sum>p->sum){q->next=p->next;r->next=p;p->next=s;s=p;p=q->next;if(p==NULL)break;}}break;}case 3:{if(m==1){while(s->ave<p->ave){q->next=p->next;r->next=p;p->next=s;s=p;p=q->next;if(p==NULL)break;}}else{while(s->ave>p->ave){q->next=p->next;r->next=p;p->next=s;s=p;p=q->next;if(p==NULL)break;}}break;}default: return;}if(p==NULL){break;}q=p;p=p->next;}r=s;s=s->next;q=s;p=q->next;if(p==NULL){break;}}cout<<"┏━━━━━━━━━━━━━━━━━━┓"<<endl;cout<<"┃!成功完成排序操作,即将输出排序结果!┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━━━━┛"<<endl;cout<<" ";system("pause");displist();}////////////////////////////////////////修改函数的实现void student::rework(int n,string str){student *p=curnode;bool b;int i=1;if(!(curnode=head->next)){cout<<"┏━━━━━━━━━━━━━━━━┓"<<endl;cout<<"┃!这是一个空表没有需要修改的数据!┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━━┛"<<endl;curnode=p;cout<<" ";system("pause");return;}while(curnode!=NULL){switch(n){case 1: b=curnode->number==str;break;case 2: b=curnode->name==str;break;default: return;}if(b){i=0;string Number;string Name;double Computer;double ENglish;double Math;cout<<"┏━━━━━━━━━━━━━━━━┓"<<endl;cout<<"┃!请在原数据后面输入要修改的数据!┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━━┛"<<endl;cout<<" 学号:"<<curnode->number<<" ";cin>>Number;curnode->number=Number;cout<<" 姓名:"<<curnode->name<<" ";cin>>Name;curnode->name=Name;while(1){cout<<" 计算机:"<<curnode->computer<<" ";cin>>Computer;while(cin.fail()){err_char();cout<<" 计算机:"<<curnode->computer<<" ";cin>>Computer;}if(Computer>=0&&Computer<=100)break;elsescore_err();}curnode->computer=Computer;while(1){cout<<" 英语:"<<curnode->English<<" ";cin>>ENglish;while(cin.fail()){err_char();cout<<" 英语:"<<curnode->English<<" ";cin>>ENglish;}if(ENglish>=0&&ENglish<=100)break;elsescore_err();}curnode->English=ENglish;while(1){cout<<" 数学:"<<curnode->math<<" ";cin>>Math;while(cin.fail()){err_char();cout<<" 数学:"<<curnode->math<<" ";cin>>Math;}if(Math>=0&&Math<=100)break;elsescore_err();}curnode->math=Math;}curnode=curnode->next;}if(i){cout<<"┏━━━━━━━━━━━┓"<<endl;cout<<"┃!找不到需要修改的数据!┃"<<endl;cout<<"┗━━━━━━━━━━━┛"<<endl;}else{cout<<"┏━━━━━━━━━┓"<<endl;cout<<"┃!数据修改全部完成!┃"<<endl;cout<<"┗━━━━━━━━━┛"<<endl;}cout<<" ";system("pause");curnode=p;}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////常用函数调用void name_of_number();//选择姓名还是学号void menu()//系统菜单函数的定义{cout<<"┏━━━━━━━━━━━━━━━━━┓"<<endl;cout<<"┃欢迎使用信管专业学生成绩管理系统┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃主菜单┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃(请按提示操作)┃"<<endl;cout<<"┃┃"<<endl;cout<<"┣━━━━━━━━━━━━━━━━━┫"<<endl;cout<<"┃┃"<<endl;cout<<"┃ 1 录入成绩 2 删除记录┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃ 3 修改记录 4 记录排序┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃ 5 查看记录 6 查找信息┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃7 删除全部┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃其他键退出┃"<<endl;cout<<"┃┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━━━┛"<<endl;cout<<" 选择1-7数字进行操作"<<endl;cout<<" 你的选择是:";}//查找函数的调用void fun_lookup(student &a){int n;string str;name_of_number();cout<<" 你的选择是:";cin>>n;while(cin.fail()){err_char();cout<<" 你的选择是:";cin>>n;}if(n!=1&&n!=2)n=1;cout<<" 请输入查找关键字:";cin>>str;a.lookup(n,str);}//修改函数void fun_rework(student &a){int n;string str;name_of_number();cout<<" 你的选择是:";cin>>n;while(cin.fail()){err_char();cout<<" 你的选择是:";cin>>n;}if(n!=1&&n!=2)n=1;cout<<" 请输入修改关键字:";cin>>str;a.rework(n,str);}//删除函数的调用void fun_del(student &a){int n;string str;name_of_number();cout<<" 你的选择是:";cin>>n;while(cin.fail()){err_char();cout<<" 你的选择是:";cin>>n;}if(n!=1&&n!=2)n=1;cout<<" 请输入删除关键字:";cin>>str;a.del_score(n,str);}//排序函数的调用void fun_compositor(student &a) {int n,m;cout<<"┏━━━━━━━━━━━━━━━━━┓"<<endl; cout<<"┃请输入按什么排序┃"<<endl; cout<<"┃┃"<<endl; cout<<"┃ 1 按学号排序 2 按总分排序┃"<<endl; cout<<"┃ 3 按平均分排┃"<<endl; cout<<"┃┃"<<endl; cout<<"┃输入其它数字则按学号排序┃"<<endl; cout<<"┃输入其它不是数字重新输入┃"<<endl; cout<<"┗━━━━━━━━━━━━━━━━━┛"<<endl; cout<<" 你的选择是:";cin>>n;while(cin.fail()){err_char();cout<<" 你的选择是:";cin>>n;}if(n!=1&&n!=2&&n!=3){n=1;}cout<<"┏━━━━━━━━━━━━━━━━━┓"<<endl; cout<<"┃请选择排序类型┃"<<endl; cout<<"┃┃"<<endl; cout<<"┃ 1 按降序排序 2 按升序排序┃"<<endl; cout<<"┃┃"<<endl; cout<<"┃输入其它数字则按降序排序┃"<<endl; cout<<"┃┃"<<endl; cout<<"┃输入其它不是数字重新输入┃"<<endl; cout<<"┗━━━━━━━━━━━━━━━━━┛"<<endl; cout<<" 你的选择是:";cin>>m;while(cin.fail()){err_char();cout<<" 你的选择是:";cin>>m;}if(n!=1&&n!=2){m=1;}//输出排序后的结果positor(n,m);}//成绩范围检测函数void score_err(){cout<<"┏━━━━━━━━━━━━━━━┓"<<endl;cout<<"┃输入的成绩应该在0--100之间┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃请返回重新输入┃"<<endl;cout<<"┗━━━━━━━━━━━━━━━┛"<<endl;}//退出程序函数void fun_exit(){cout<<"┏━━━━━━━━━━┓"<<endl;cout<<"┃程序即将退出┃"<<endl;cout<<"┗━━━━━━━━━━┛"<<endl;cout<<" ";system("pause");exit(1);}//输入错误字符检测函数void err_char(){cout<<"┏━━━━━━━━━━━━━┓"<<endl;cout<<"┃输入了非法字符,请重新输入┃"<<endl;cout<<"┗━━━━━━━━━━━━━┛"<<endl;cin.clear ();cin.sync ();}//选择姓名还是学号void name_of_number(){cout<<"┏━━━━━━━━━━┓"<<endl;cout<<"┃请输入关键字类型┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃ 1 学号 2 姓名┃"<<endl;cout<<"┃┃"<<endl;cout<<"┃其它数字默认学号┃"<<endl;cout<<"┃输入非数字重新输入┃"<<endl;cout<<"┗━━━━━━━━━━┛"<<endl;}////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////主函数文件void fun_lookup(student &a);//查找函数的调用定义void fun_del(student &a);//删除函数的调用定义void fun_compositor(student &a);//排序函数的调用定义void fun_rework(student &a);//修改函数的调用定义void fun_exit();//退出程序函数的定义void main(){student a;while(1){int i;system("cls"); //清屏功能menu();cin>>i;if(cin.fail()) //输入非法字符时退出fun_exit();switch (i){case 1: a.cin_app();break; //增加记录case 2: fun_del(a);break; //删除记录case 3: fun_rework(a);break; //修改记录case 4: fun_compositor(a);break; //记录排序case 5: a.displist();break; //查看记录case 6: fun_lookup(a);break; //查找记录case 7: a.del_score();break; //清空链表default: fun_exit(); //其它键退出}}}。

相关主题