common_people.h

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

H
61
字号
#ifndef iostream_h
#include <iostream.h>
#endif

#include <fstream>
using namespace std;
#ifndef common_people_h
#define common_people_h

class common_people
{
    friend class list;
public:
    int type;
	char name[30];
	int number;
	char sex[30];
	char birthday[30];
    int maths,computer,english,total;
	common_people *ptr,*next;
    common_people()
		{ 
		  type=-1;
		  name[0]='\0';
		  number=-1;
		  sex[0]='\0';
		  next=NULL;
		  maths=-1;
		  computer=-1;
		  english=-1;
		  total=-1;
		}
	common_people(char *name1,int num,char *sex1,char *birth)
		{ 
		  type=-1;
		  strcpy(name,name1);
		  number=num;
		  strcpy(sex,sex1);
		  strcpy(birthday,birth);
		  next=NULL;
		  maths=-1;
		  computer=-1;
		  english=-1;
		  total=-1;
		}
    virtual void print()
		{
			cout<<"编号:"<<number<<"   姓名:"<<name<<"  性别:"<<sex<<"   出生日期:"<<birthday<<endl;
		}
	virtual void getnode(){};
    virtual void sav(char *nam);
};

void common_people::sav(char *nam)
{
	ofstream fileout(nam,ios_base::app);
	fileout<<-1<<endl<<type<<endl<<number<<endl<<name<<endl<<sex<<endl<<birthday<<endl<<maths<<endl<<computer<<endl<<english<<endl;
	fileout.close();
}
#endif

⌨️ 快捷键说明

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