#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(只能为字符,包括汉字):"<
cout<<"Please input sex of person(只能为字符,包括汉字):"<
cout<<"Please input address of person(只能为字符,包括汉字):"<
cout<<"Please input brithday.year of person(只能为数字):"<
cout<<"Please input brithday.month of person(只能为数字):"<
cout<<"Please input brithday.day of person(只能为数字):"<
}
void show()
{
cout<<"name:"<
};
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(输入学生班级):"<
cout<<"Please input major of stduent(输入学生所在系):"<
cout<<"Please input coursrs of stduent(只能为字符,包括汉字):"<
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(只能为数字):"<
cout<<"Please input register.month of stduent(只能为数字):"<
cout<<"Please input register.day of stduent(只能为数字):"<
}
void show_1()
{
cout<<"sclass:"<
};
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次。):"<
cout<<"Please input register.year of teacher(只能为数字):"<
cout<<"Please input register.month of teacher(只能为数字):"<
cout<<"Please input register.day of teacher(只能为数字):"<
}
void show_2()
{
cout<<"courses:"<
};
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;
}