资源预览内容
第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
亲,该文档总共3页全部预览完了,如果喜欢就下载吧!
资源描述
#include#includeusing namespace std;class employeeprotected:char name15;char address10;char city10;int postcode;public: employee();/构造函数employee();/ 析构函数void setname(char *);char * getname();void display();void setadr(char *);void setcity(char *);void setpostcode(int post);char * getadr();char * getcity();int getpost();employee:employee()/默认构造employee:employee();void employee:setname(char *names) strcpy(name,names);char * employee:getname()return name;void employee:setadr(char *adr)strcpy(address,adr);void employee:setcity(char *ct)strcpy(city,ct);void employee:setpostcode(int post)postcode=post;int employee:getpost()return postcode;char * employee:getadr()return address;char * employee:getcity()return city;void employee:display() cout此员工的姓名:getname(); cout此员工所在街道地址:getadr(); cout此员工所在城市:getcity(); cout此员工所在地的邮政编码:getpost(); void main()int i,k;employee emp4; char namestr15;char adr10;char ct10;int post;for(i=0;i2;i+)coutnamestr; empi.setname(namestr); coutadr; empi.setadr(adr); coutct; empi.setcity(ct); coutpost;empi.setpostcode(post); coutendl; cout请输入要显示的员工号(1=kk;empk.display();
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号