cat类 C++

cat类 C++,第1张

class CAT

{

public:

static int Count

CAT(int a,int b,bool c):Age(a),Weight(b),Status(c)

{

Count++

}

~CAT()

{

Count--

}

CAT(CAT s)

{

Age=s.Age

Weight=s.Weight

Status=s.Status

Count++

}

void Walk()

void Eat()

void Sleep()

void Grow()

private:

int Age,Weight

bool Status

}

void CAT::Walk()

{}

void CAT::Eat()

{}

void CAT::Sleep()

{}

void CAT::Grow()

{}

int CAT:Count=0

void main()

{

}

至于什么循环、菜单什么的具体 *** 作,不清楚你的具体要求,请你自己写吧!很简单的啦!

没个回复?怎么回事啦?

#include <iostream>

#include <string>

using namespace std

class animal

{

public:

animal(string n){ name = n }

string GetName(){ return name }

virtual float GetWeight()= 0

private :

string name

}

class dog :public animal

{

public:

dog(float w, string n) :animal(n){ weight = w }

float GetWeight() { return weight }

private:

float weight

}

class cat : public animal

{

public:

cat(float w, string n) :animal(n){ weight = w }

float GetWeight() { return weight }

private:

float weight

}

void main()

{

dog d(2,"dog1")

cat c(1, "cat1")

cout << d.GetName() << ":" << d.GetWeight() << "KG" << endl

cout << c.GetName() << ":" << c.GetWeight() << "KG" << endl

}

不是不知道程序怎么写,你连怎么的原理都没有弄清楚,当然不知道怎么写,遥控器一般是38Khz的红外线,你先去看看通信协议,硬件设计用一个接收器接在外部中断脚上,推荐一个HS0038,具体程序,自己看着办吧!


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12130262.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-21
下一篇 2023-05-21

发表评论

登录后才能评论

评论列表(0条)

保存