⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 people.cpp

📁 c++模板小实验
💻 CPP
字号:
//people.cpp
#include "iostream.h"
#include "people.h"
#include "string.h"
birthday::birthday(int a=0,int b=0,int c=0)
{
cout<<"build a day!"<<endl;
year=a;
month=b;
day=c;
};
birthday::~birthday()
{
cout<<"delete a day!"<<endl;
}

people::people(char a[11],char b[7],Sex c,birthday d,char e[15]):born(d)
{cout<<"build a people"<<endl;
 strcpy(name,a);
 strcpy(number,b);
 sex=c;
 born.year=d.year ;
 born.month=d.month ;
 born.day=d.day ;
 strcpy(id,e);
}
people::~people()
{cout<<"delete a people!"<<endl;
}
void people::operator = (people c)
{
strcpy(name,c.name);
strcpy(number,c.number);
sex=c.sex;
born.year=c.born.year;
born.month=c.born.month;
born.day=c.born.day;
strcpy(id,c.id);
}
 people::operator==(people b)
{
 if(strcmp(id,b.id)==0) {cout<<"true"<<endl;}
 else {cout<<"false"<<endl;}
}
void people::output()
{
cout<<"Information of the people:"<<endl;
cout<<"name "<<name<<endl;
cout<<"number "<<number<<endl;
cout<<"sex "<<sex<<endl;
cout<<"birthday "<<born.year<<" "<<born.month<<" "<<born.day<<endl;
cout<<"Id number "<<id<<endl;
}

⌨️ 快捷键说明

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