这个哪里出现问题了呢……

#include
using namespace std;
class cube
{
public://使设置的长宽高公共化
void setl(int l)//设置长
{
m_l=l;
}
int getl()//获取长
{
return m_l;
}
void setw(int w)
{
m_w=w;
}
int getw()
{
return m_w;
}
void seth(int h)
{
m_h=h;
}
int geth()
{
return m_h;
}
int calulateS()//获取立方体面积
{
return 2m_lm_w+2m_lm_h+2m_hm_w;
}
int calulateV()//获取立方体体积
{
return m_lm_wm_h;
}
//利用成员函数判断两个立方体是否相等
bool issamebyclass(cube &c)//传入一个参数即可,和函数内部的值进行比较
{
if(m_l==c.getl()&&m_w==c.getw()&&m_h==
c.geth())//这里可以直接访问m_l,因为类内可以访问
{
return true;
}
else
{
return false;
}
private:
int m_l;
int m_w;
int m_h;
};
//利用全局函数判断两个立方体是否相等
bool issame(cube &c1,cube &c2)//引用是用的原始数据,不是拷贝的数据
{
if(c1.getl()==c2.getl()&&c1.getw()==c2.getw()&&c1.geth()==
c2.geth())//在这里set等都是函数,后面记得加括号
{
return true;
}
return false ;//如果不加上这一句,可能没有返回值
}
int main()
{
cube c1;
c1.setl(10);
c1.setw(20);
c1.seth(5);
cout<<c1.calulateS()<<" "<<c1.calulateV();//这里要加上在什么对象下的函数
cube c2;
c2.setl(10);
c2.setw(20);
c2.seth(5);
bool res=issame(c1,c2);
if(res)
{
cout<<"两个立方体是相等的";
}
else
{
cout<<"两个立方体是不相等的";
}
bool res=c1.issamebyclass(c2);
if(res)
{
cout<<"两个立方体是相等的";
}
else
{
cout<<"两个立方体是不相等的";
}
}


#include <stdio.h>
#include <iostream>
using namespace std;
class cube
{
private:
    int m_l;
    int m_w;
    int m_h;
public://使设置的长宽高公共化
    void setl(int l);//设置长
    int getl();//获取长
    void setw(int w);
    int getw();
    void seth(int h);
    int geth();
    int calulateS();//获取立方体面积
    int calulateV();//获取立方体体积
    //利用成员函数判断两个立方体是否相等
    bool issamebyclass(cube &c);//传入一个参数即可,和函数内部的值进行比较;
    //利用全局函数判断两个立方体是否相等
    bool issame(cube &c1, cube &c2);//引用是用的原始数据,不是拷贝的数据
};

int main()
{
    cube c1;
    c1.setl(10);
    c1.setw(20);
    c1.seth(5);
    cout << c1.calulateS() << " " << c1.calulateV();//这里要加上在什么对象下的函数
    cube c2;
    c2.setl(10);
    c2.setw(20);
    c2.seth(5);
    bool res = c1.issame(c1, c2);
    if (res)
    {
        cout << "两个立方体是相等的";
    }
    else
    {
        cout << "两个立方体是不相等的";
    }
    bool res = c1.issamebyclass(c2);
    if (res)
    {
        cout << "两个立方体是相等的";
    }
    else
    {
        cout << "两个立方体是不相等的";
    }
}

void cube::setl(int l) //设置长
{
    m_l = l;
}

int cube::getl() //获取长
{
    return m_l;
}

void cube::setw(int w)
{
    m_w = w;
}

int cube::getw()
{
    return m_w;
}

void cube::seth(int h)
{
    m_h = h;
}

int cube::geth()
{
    return m_h;
}

int cube::calulateS() //获取立方体面积
{
    return 2 * (m_l*m_h) + 2 * (m_h*m_w) + 2 * (m_l*m_w);
//    return 2m_lm_w + 2m_lm_h + 2m_hm_w;
}

int cube::calulateV() //获取立方体体积
{
    return m_h*m_l*m_w;
}

bool cube::issamebyclass(cube &c) //传入一个参数即可,和函数内部的值进行比较
{
    if (m_l == c.getl() && m_w == c.getw() && m_h ==
        c.geth())//这里可以直接访问m_l,因为类内可以访问
    {
        return true;
    }
    else
    {
        return false;
    }
}

bool cube::issame(cube &c1, cube &c2) //引用是用的原始数据,不是拷贝的数据
{
    if (c1.getl() == c2.getl() && c1.getw() == c2.getw() && c1.geth() == c2.geth())//在这里set等都是函数,后面记得加括号
    {
        return true;
    }
    return false;//如果不加上这一句,可能没有返回值
}