c++编写学生评教管理系统

2020-09-16 社会 129阅读
好久没写了,一直在写pascal,今天给大家做个参考:
#include
#include
using namespace std;
class person
{public:
struct date
{
short int year;
int month;
int day;
};
char name[8],sex[8],address[30];
date brithday;
void read()
{
cout<<"Please input name of person(只能为字符,包括汉字):"< cin>>name;
cout<<"Please input sex of person(只能为字符,包括汉字):"< cin>>sex;
cout<<"Please input address of person(只能为字符,包括汉字):"< cin>>address;
cout<<"Please input brithday.year of person(只能为数字):"< cin>>brithday.year;
cout<<"Please input brithday.month of person(只能为数字):"< cin>>brithday.month;
cout<<"Please input brithday.day of person(只能为数字):"< cin>>brithday.day;
}
void show()
{
cout<<"name:"< cout<<"sex:"< cout<<"address:"< cout<<"brithday:"< }
};
class student:public person
{public:
struct course
{
string cname[16];
};
struct date
{
int year;
int month;
int day;
};
char sclass[6];
char major[16];
course courses;
date sregister;
void read_1()
{
cout<<"Please input class of stduent(输入学生班级):"< cin>>sclass;
cout<<"Please input major of stduent(输入学生所在系):"< cin>>major;
cout<<"Please input coursrs of stduent(只能为字符,包括汉字):"< cin>>courses.cname[0];
cin>>courses.cname[1];
cin>>courses.cname[2];
cin>>courses.cname[3];
cin>>courses.cname[4];
cin>>courses.cname[5];
cout<<"Please input register.year of stduent(只能为数字):"< cin>>sregister.year;
cout<<"Please input register.month of stduent(只能为数字):"< cin>>sregister.month;
cout<<"Please input register.day of stduent(只能为数字):"< cin>>sregister.day;
}
void show_1()
{
cout<<"sclass:"< cout<<"major:"< cout<<"coursrs:"< cout<<"sregister:"< }
};
class teacher:public person
{public:
struct course
{
string cname[6];
};
struct date
{
int year;
int month;
int day;
};
course courses;
date tregister;
void read_2()
{
cout<<"Please input one course of teacher teaching(只能为字符,包括汉字,输6次。):"< cin>>courses.cname[0]>>courses.cname[1]>>courses.cname[2]>>courses.cname[3]>>courses.cname[4]>>courses.cname[5];
cout<<"Please input register.year of teacher(只能为数字):"< cin>>tregister.year;
cout<<"Please input register.month of teacher(只能为数字):"< cin>>tregister.month;
cout<<"Please input register.day of teacher(只能为数字):"< cin>>tregister.day;
}
void show_2()
{
cout<<"courses:"< cout<<"tregister:"< };
};
int main()
{

student stud_y;
teacher stud_z;
stud_y.read();
stud_y.read_1();
stud_y.show();
stud_y.show_1();
stud_z.read();
stud_z.read_2();
stud_z.show();
stud_z.show_2();
return 0;
}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com