代码错了,但是不知道应该怎么改,想问一下

#include
using namespace std;
class Box
{
private:double length;
double breadth;
double height;
};
int main( )
{
Box Box1;
Box Box2;
double volume = 0.0;
Box1.height = 5.0;
Box1.length = 6.0;
Box1.breadth = 7.0;
Box2.height = 10.0;
Box2.length = 12.0;
Box2.breadth = 13.0;
volume = Box1.height * Box1.length * Box1.breadth;
cout << "Box1 的体积:" << volume <<endl;
volume = Box2.height * Box2.length * Box2.breadth;
cout << "Box2 的体积:" << volume <<endl;
return 0;
}

#include<iostream> 
using namespace std;
class Box
{
public:
    double length;
    double breadth;
    double height;
};
int main()
{
Box Box1;
Box Box2;
double volume = 0.0;
Box1.height = 5.0;
Box1.length = 6.0;
Box1.breadth = 7.0;
Box2.height = 10.0;
Box2.length = 12.0;
Box2.breadth = 13.0;
volume = Box1.height * Box1.length * Box1.breadth;
cout << "Box1 的体积:" << volume <<endl;
volume = Box2.height * Box2.length * Box2.breadth;
cout << "Box2 的体积:" << volume <<endl;
return 0;
}

img

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632