全文预览

C++上机实验报告-实验四

上传者:你的雨天 |  格式:docx  |  页数:16 |  大小:939KB

文档介绍
ate(Date&p);?~Date();?voidsetDate();?voidshowDate();};//People类,其中含Date类型的数据classPeople{private:?charname[11];?charnumber[7];?charsex[3];?Datebirthday;?charid[16];public:?People();?People(char*n,char*nu,char*s,Dateb,char*i);?People(People&p);?~People();?voidsetName();?voidsetNumber();?voidsetSex();?voidsetId();?voidshowPeople();};//Date构造函数Date::Date(){}Date::Date(inty,intm,intd)?{ year=y; month=m; day=d;?}Date::Date(Date&p){?year=p.year;?month=p.month;?day=p.day;}//析构inlineDate::~Date(){}//Date成员函数,设置出生年月日voidDate::setDate()?{ inty,m,d; cout<<"Inputtheyear:"; cin>>y; cout<<"Inputthemonth:"; cin>>m; cout<<"Inputtheday:"; cin>>d; year=y; month=m; day=d;?}//Date内联成员函数,输出年月日inlinevoidDate::showDate()?{ cout<<"Birthdayis"<<year<<"年"<<month<<"月"<<day<<"日"<<endl;?}//People构造函数People::People(){};

收藏

分享

举报
下载此文档