求三个长方柱体积.cpp

来源:互联网 发布:学霸模式软件 编辑:程序博客网 时间:2024/04/29 18:23

#include<iostream>
using namespace std;
class Box
{
public:
long length;
long width;
long height;
void  voiume();
};
void Box::voiume()
{
cout<<"the voiume is:"<<endl;
cout<<height*length*width<<endl;
}
int main()
{
  Box box1,box2,box3;
  cout<<"box1:"<<endl;
  cin>>box1.height>>box1.length>>box1.width;
  cout<<"box2:"<<endl;
  cin>>box2.height>>box2.length>>box2.width;
  cout<<"box3:"<<endl;
  cin>>box3.height>>box3.length>>box3.width;
  box1.voiume();
  box2.voiume();
  box3.voiume();
}

 、、

 

0 0
原创粉丝点击