抓小偷编程题目c语言,如何使用面相对象编程和c++实现:警察抓小偷的任务
满意答案_注册用户_2013.10.31采纳率:55%等级:12已帮助:6250人class Role{public:Role(){x = Random();y = Random();}inline void Up(){y+=5;if(y>MAX_HEIGHT) y=MAX_HEIGHT;}inline void Down(){y-=5;if(y}inline void Left()...
满意答案

_注册用户_
2013.10.31

采纳率:55% 等级:12
已帮助:6250人
class Role
{
public:
Role()
{
x = Random();
y = Random();
}
inline void Up()
{
y+=5;
if(y>MAX_HEIGHT) y=MAX_HEIGHT;
}
inline void Down()
{
y-=5;
if(y
}
inline void Left()
{
x-=5;
if(x
}
inline void Right()
{
x+=5;
if(x>MAX_WIDTH) y=MAX_WIDTH;
}
private:
int x;//横坐标
int y;//纵坐标
ICON icon //角色图标
};
class Player : public class Role
{
public:
Player()
{
SetICON();
}
};
class Thief : public class Role
{
public:
Player()
{
SetICON();
}
};
00分享举报
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)