欢迎来到天天文库
浏览记录
ID:51780467
大小:36.00 KB
页数:12页
时间:2020-03-15
《小型学生信息管理系统.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、/************************************************************************//*Author:TigerDate:6/15/2013Function:小型信息管理系统Version:1.11、增加了学生成绩输入范围的检查。2、优化部分代码。*//************************************************************************/#include#include#include2、ng.h>//学生基类classStudent{protected:charname[20];//姓名floatscore1,score2,score3;//成绩1、2、3、public:voidgetname(chara[]);//得到学生的姓名,用于查询voidset();//设置学生信息voidshow();//显示学生信息voidaverage();//计算并输出平均成绩floatcheck_score(inti,floatsc);//输入学生的第i门的成绩,分数在(0---100)};floatStudent::check_score(inti,flo3、atsc){cout<<"成绩"<>sc;if(sc<04、5、sc>100){cout<<"输入成绩有误!"<6、{cout<<"学生姓名:";cin>>name;//输入并检查成绩的范围floattemp_sc=0;score1=check_score(1,temp_sc);score2=check_score(2,temp_sc);score3=check_score(3,temp_sc);}voidStudent::average(){cout<<"姓名:"<7、protected:charhouseholder[20];//家长public:Middle_school_student();voidset();voidshow();};Middle_school_student::Middle_school_student(){strcpy(name,"张三");score1=0;score2=0;score3=0;strcpy(householder,"李四");}voidMiddle_school_student::set(){Student::set();cout<<"家长:";cin>>householder;}8、voidMiddle_school_student::show(){Student::show();cout<<"家长:"<9、0;strcpy(profession,"无");}voidUniversity_student::set(){Student::set();cout<<"专业:";cin>>profession;}voidUniversity_student::show(){Student::show();cout<<"专业:"<10、ate::Postgra
2、ng.h>//学生基类classStudent{protected:charname[20];//姓名floatscore1,score2,score3;//成绩1、2、3、public:voidgetname(chara[]);//得到学生的姓名,用于查询voidset();//设置学生信息voidshow();//显示学生信息voidaverage();//计算并输出平均成绩floatcheck_score(inti,floatsc);//输入学生的第i门的成绩,分数在(0---100)};floatStudent::check_score(inti,flo
3、atsc){cout<<"成绩"<>sc;if(sc<0
4、
5、sc>100){cout<<"输入成绩有误!"<6、{cout<<"学生姓名:";cin>>name;//输入并检查成绩的范围floattemp_sc=0;score1=check_score(1,temp_sc);score2=check_score(2,temp_sc);score3=check_score(3,temp_sc);}voidStudent::average(){cout<<"姓名:"<7、protected:charhouseholder[20];//家长public:Middle_school_student();voidset();voidshow();};Middle_school_student::Middle_school_student(){strcpy(name,"张三");score1=0;score2=0;score3=0;strcpy(householder,"李四");}voidMiddle_school_student::set(){Student::set();cout<<"家长:";cin>>householder;}8、voidMiddle_school_student::show(){Student::show();cout<<"家长:"<9、0;strcpy(profession,"无");}voidUniversity_student::set(){Student::set();cout<<"专业:";cin>>profession;}voidUniversity_student::show(){Student::show();cout<<"专业:"<10、ate::Postgra
6、{cout<<"学生姓名:";cin>>name;//输入并检查成绩的范围floattemp_sc=0;score1=check_score(1,temp_sc);score2=check_score(2,temp_sc);score3=check_score(3,temp_sc);}voidStudent::average(){cout<<"姓名:"<7、protected:charhouseholder[20];//家长public:Middle_school_student();voidset();voidshow();};Middle_school_student::Middle_school_student(){strcpy(name,"张三");score1=0;score2=0;score3=0;strcpy(householder,"李四");}voidMiddle_school_student::set(){Student::set();cout<<"家长:";cin>>householder;}8、voidMiddle_school_student::show(){Student::show();cout<<"家长:"<9、0;strcpy(profession,"无");}voidUniversity_student::set(){Student::set();cout<<"专业:";cin>>profession;}voidUniversity_student::show(){Student::show();cout<<"专业:"<10、ate::Postgra
7、protected:charhouseholder[20];//家长public:Middle_school_student();voidset();voidshow();};Middle_school_student::Middle_school_student(){strcpy(name,"张三");score1=0;score2=0;score3=0;strcpy(householder,"李四");}voidMiddle_school_student::set(){Student::set();cout<<"家长:";cin>>householder;}
8、voidMiddle_school_student::show(){Student::show();cout<<"家长:"<9、0;strcpy(profession,"无");}voidUniversity_student::set(){Student::set();cout<<"专业:";cin>>profession;}voidUniversity_student::show(){Student::show();cout<<"专业:"<10、ate::Postgra
9、0;strcpy(profession,"无");}voidUniversity_student::set(){Student::set();cout<<"专业:";cin>>profession;}voidUniversity_student::show(){Student::show();cout<<"专业:"<10、ate::Postgra
10、ate::Postgra
此文档下载收益归作者所有