设为首页收藏本站

SKY外语、计算机论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 6657|回复: 2
打印 上一主题 下一主题

测试问题贴啦

[复制链接]

3

主题

1

好友

114

积分

注册会员

Rank: 2

自我介绍
胆小,诚实,对朋友认真,不喜欢说
生肖
星座
双子座
性别
保密

最佳新人

楼主
发表于 2013-6-29 00:52:02 |显示全部楼层
//proj3.cpp
#include<iostream>
using namespace std;
class Date
{
public:
  int year;
  int month;
  int day;
  Date():year(0),month(0),day(0){}
  Date(int y,int m,int d):year(y),month(m),day(d){}
};
class Person
{
  char idcardno[16];    //身份证号
  char name[20];        //姓名
  Date birthdate;       //出生日期
  bool ismale;          //性别:true为男,false为女
public:
  Person(const char *pid, const char *pname, Date pdate, bool pmale);
  const char *getIDCardNO()const{ return idcardno; }
  const char *getName()const{ return name; }
  void rename(const char *new_name);
  Date getBirthDate()const{ return birthdate; }
  bool isMale()const{ return ismale;}
};
class Staff: public Person
{
  char department[20];   //工作部门
  double salary;         //工资
public:
  Staff(const char *id_card_no, const char *p_name, Date birth_date, bool is_male,
        const char *dept, double sal);
  const char *getDepartment()const{ return department; }
  void setDepartment(const char *d);
  double getSalary()const{ return salary; }
  void setSalary(double s){ salary=s; }
};

Person:erson(const char *id_card_no, const char *p_name, Date birth_date, bool is_male)
:birthdate(birth_date),ismale(is_male)
{
//**1** **********found**********
  ______________________________;
  strcpy(name,p_name);
}

void Person::rename(const char *new_name){ strcpy(name,new_name); }

Staff::Staff(const char *id_card_no, const char *p_name, Date birth_date, bool is_male,
//**2** **********found**********
  const char *dept, double sal):______________________________
{
  setDepartment(dept);
  setSalary(sal);
}

void Staff::setDepartment(const char *dept)
{
  strcpy(department,dept);
}

int main()
{
//**3** **********found**********
  ______________________________;
  Zhangsan.rename("张小丽");
  cout<<Zhangsan.getName()<<Zhangsan.getIDCardNO()<<endl;
  return s0;
}
有什么不知道的地方 可以来yy 4350 哦!那里高手很多。
回复

使用道具 评分 举报

3

主题

1

好友

114

积分

注册会员

Rank: 2

自我介绍
胆小,诚实,对朋友认真,不喜欢说
生肖
星座
双子座
性别
保密

最佳新人

沙发
发表于 2013-6-29 00:53:03 |显示全部楼层
图是  :  p
有什么不知道的地方 可以来yy 4350 哦!那里高手很多。
回复

使用道具 评分 举报

3

主题

1

好友

114

积分

注册会员

Rank: 2

自我介绍
胆小,诚实,对朋友认真,不喜欢说
生肖
星座
双子座
性别
保密

最佳新人

板凳
发表于 2013-6-30 00:36:58 |显示全部楼层
这是计算机二级试题! :p  被想识别成图了
有什么不知道的地方 可以来yy 4350 哦!那里高手很多。
回复

使用道具 评分 举报

您需要登录后才可以回帖 登录 | 立即注册


手机版|SKY外语计算机学习 ( 粤ICP备12031577 )    

GMT+8, 2024-5-2 08:38 , Processed in 0.108723 second(s), 26 queries .

回顶部