person.cpp

来自「我大一时候做的C++课程设计」· C++ 代码 · 共 59 行

CPP
59
字号
#include"person.h"
#include<iostream.h>
#include<string.h>
#include<stdlib.h>
#include <iomanip.h>

int person::count=0;

person::person()
{
	strcpy(name,"NULL");
	birthday.year=9999;birthday.month=99;birthday.day=99;
	sex='N';
	strcpy(num,"NULL");
	strcpy(nationality,"NULL");
	strcpy(education,"NULL");
	strcpy(address,"NULL");
	strcpy(telNum,"NULL");
	strcpy(Email,"NULL");
	count++;
	
}
person::~person()	{}

void person::print()
{
	cout<<setw(10)<<name<<setw(8)<<birthday.year<<setw(3)<<birthday.month<<setw(3)<<birthday.day
		<<setw(3)<<sex<<setw(8)<<num<<setw(6)<<nationality
		<<setw(8)<<education<<setw(11) <<address<<setw(8)<<telNum<<setw(10)<<Email<<endl;
}

/*b person::get_birth()
{
	return birthday;
}*/

int person::get_birth()
{
	return birthday.year*10000+birthday.month*100+birthday.day;
}

void person::set_inf(char *na,int y,int m,int d,char s, char *nu,char *nation,char *ed,char *add,char *tel, char *e)
{
	strcpy(name,na);
	birthday.year=y;birthday.month=m;birthday.day=d;
	sex=s;
	strcpy(num,nu);
	strcpy(nationality,nation);
	strcpy(education,ed);
	strcpy(address,add);
	strcpy(telNum,tel);
	strcpy(Email,e);

}

int person::get_ct()	{return count;}


⌨️ 快捷键说明

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