- 22
- 0
- 约8.95千字
- 约 14页
- 2020-01-15 发布于江苏
- 举报
#include iostream
#include stdlib.h
using namespace std;
class pet // 建立一个宠物类
{
public:
pet(int a=0,int h=0,int t=0,int m=0,int he=0,int st=15) // 构造函数
{age=a;hunger=h;thirst=t;mood=m;health=he;step=st;}
int geta() {return age;} //提取各个私有成员
int geth() {return hunger;}
int gett() {return thirst;}
int getm() {return mood;}
int gethe() {return health;}
int getst() {return step;}
void p2(); // 饥饿、口渴以及心情随时间的变化函数
void show(); // 各个数值的输出函数
void emergency(int w); //各种特殊状态函数
void feed() // 喂食函数
{
hunger--;
step=step-5;
}
void drink() {thirst--;step=step-3;} //喂水函数
void doctor() {step=step-10;} // 看医生函数
您可能关注的文档
- 1信息服务业务(仅限互联网信息服务)发展和实施计划专用表格1.docx
- 2018年度机修车间安全生产培训计划.docx
- 2018文明礼仪教育实施方案.docx
- 7设计和开发控制程序.docx
- 89c51单片机c语言编写的pwm程序.docx
- 8086汇编语言程序设计实验指导书.docx
- c++数组指针题(含答案).docx
- b2c跨境电商题目.docx
- c程序设计作业(5).docx
- c语言--第六章:函数--教学设计(修改).docx
- 全文可编辑培训课件-机构研究报告-德国数字音乐用户分析报告:deezer -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国退休用户分析报告-外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国洗衣机用户分析报告:candy -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国新闻日报用户分析报告:koelner stadt anzeiger-外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国新闻日报用户分析报告:westdeutsche allgemeine zeitung leserinnen -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国移动运营商用户(联通)分析报告:alditalk -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国移动运营商用户(联通,电信)分析报告:alditalk -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国数字音乐用户分析报告:apple music itunes -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国洗衣机用户分析报告:beko -外文培训课件.pptx
- 全文可编辑培训课件-机构研究报告-德国洗衣机用户分析报告:miele -外文培训课件.pptx
原创力文档

文档评论(0)