common_student.h

来自「用C++编写的教师学生相关信息和统计系统」· C头文件 代码 · 共 49 行

H
49
字号
#include"common_people.h"
#ifndef common_student_h
#define common_student_h

class common_student:virtual public common_people
{ 
	friend class list;
public:
	char department1[30];
	int grade;
	common_student():common_people(){type=1;maths=computer=english=0;}
	common_student(char *name1,int num,char *sex1,char *birth,int maths1,int computer1,int english1,char *depart,int grade1):common_people(name1,num,sex1,birth)
		{ type=1;
		  maths=maths1;
		  computer=computer1;
		  english=english1;
		  total=maths+computer+english;
		  strcpy(department1,depart);
		  grade=grade1;
		}
	virtual void print();
	virtual void getnode();
	virtual void sav(char *nam);
};
//
void common_student::sav(char *nam)
{   ofstream out(nam,ios_base::app);
	out<<0<<endl<<type<<endl<<number<<endl<<name<<endl<<sex<<endl<<birthday<<endl<<maths<<endl<<computer<<endl<<english<<endl;
	out<<department1<<endl<<grade<<endl;
    out.close();
}
//
void common_student::print()
{
	common_people::print();
	cout<<"系:"<<department1<<"    年级:"<<grade<<endl;
	cout<<"数学:"<<maths<<"  计算机:"<<computer<<"  英语:"<<english<<endl;

}

//
void common_student::getnode()
{
   ptr=new common_student(name,number,sex,birthday,maths,computer,english,department1,grade);

}


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?