作业帮 > 综合 > 作业

这个程序输出来的为什么是随机数啊?

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/06/06 17:38:08
这个程序输出来的为什么是随机数啊?
#include
using namespace std;
class father
{
private:
int fatherweight,fathertall;
public:
void setfathertall(int fathertall){fathertall=fathertall;}
void setfatherweight(int fatherweight){fatherweight=fatherweight;}
void printfathertallweight(){cout
这个程序输出来的为什么是随机数啊?
你的形参名和成员变量名相同,系统也会搞混的
void setfathertall(int fathertall){fathertall=fathertall;}
//比如 fathertall=fathertall 你自己能分辨吗?
#include
using namespace std;
class father
{
private:
int fatherweight,fathertall;
public:
void setfathertall(int tall){fathertall=tall;}
void setfatherweight(int weight){fatherweight=weight;}
void printfathertallweight(){cout