c++高手请进,答得满意给加分!!!

来源:百度知道 编辑:UC知道 时间:2024/05/31 23:41:02
帮忙看看程序那里错了?
#include"iostream"
using namespace std;
class cat
{
public:
static void howmanyats();
void catchmouse(int y);

private:
static int howmanycat;

};
int cat::howmanycat = 0;
void cat::catchmouse(int y)
{
cat::howmanycat = y/2;
}

void cat::howmanycat()
{
cout<<howmanycat<<endl;
}
int main()
{ int x;
cin>>x;
cat cat1;
cat1.catchmouse(x);
cat::howmanycat();
return 0;
}

static void howmanyats();
函数名写错了

#include"iostream"
using namespace std;
class cat
{
public:

static void howmanycats();

void catchmouse(int y);

public:

static int howmanycat;

};

int cat::howmanycat = 0;

void cat::catchmouse(int y)
{

cat::howmanycat = y/2;
}

void cat::howmanycats()
{
cout<<howmanycat<<endl;
}
int main()
{
int x;
cin>>x;
cat cat1;
cat1.catchmouse(x);
cat::howmanycats();
return 0;
}

#include<iostream>
using namespace std;
class cat
{
public:
static void howmanyats();
void catchmouse(int y);

private:
static int howmanycat;

};
int cat::howmanycat = 0;
void cat::catchmouse(int y)