我是个菜鸡,实在不会了,码了段代码又运行不了,所以特地给请大佬指点一二
#include
using namespace std;
class people
{
protected:
int age;
int height;
int weight;
static int num;
public:
people(int a=18,int h=180,int w=60,int n=10 );
void eating(){weight++;}
void sporting(){height++;}
void sleeping(){age++,height++,weight++;}
friend void show(const people&pl);
friend void shownum(const people&pl);
};
int people::num=0;
people::people(int a,int h,int w,int n)
{
this->age=a;
this->height=h;
this->weight=w;
}
void show(const people&pl)
{
cout<<"年龄"<<pl.age<<"身高"<<pl.height<<"重量"<<pl.weight<<endl;
}
void shownum(const people&pl)
{
cout<<pl.num<<endl;
}
int main(void)
{
people pl(8,120,180);
pl.eating();
pl.sleeping();
pl.sporting();
void show();
void shownum();
system("pause");
return 0;
}