#include <iostream>
using namespace std;
class human
{
public:
void get_stature(){cout<<stature;}
void get_weight();
void set_stature(int x){cout<<"请输入迈克的身高:";cin>>x;stature=x;}
private:
int stature;
int weight;
};
void main()
{
int x;
human Mike;
Mike.set_stature();
Mike.get_stature();
}
5.cpp
E:\c++ 学习\5\5.cpp(51) : error C2660: 'set_stature' : function does not take 0 parameters
Error executing cl.exe.
5.exe - 1 error(s), 0 warning(s)
这个是为什么?
using namespace std;
class human
{
public:
void get_stature(){cout<<stature;}
void get_weight();
void set_stature(int x){cout<<"请输入迈克的身高:";cin>>x;stature=x;}
private:
int stature;
int weight;
};
void main()
{
int x;
human Mike;
Mike.set_stature();
Mike.get_stature();
}
5.cpp
E:\c++ 学习\5\5.cpp(51) : error C2660: 'set_stature' : function does not take 0 parameters
Error executing cl.exe.
5.exe - 1 error(s), 0 warning(s)
这个是为什么?