/*
* Copyright (c)2013, 烟台大学计算机学院学生
* All rightsreserved.
* 文件名称: array.cpp
* 作 者: 李中意
* 完成日期:2014 年 5 月3 日
* 版本号: v1.0
* 输入描述:无
*/
#include <iostream>
using namespace std;
class Box
{
public:
void get_value();
float volume();
void display();
private:
float length;
float width;
float height;
};
void Box::get_value()
{
cout<<"请输入长方体的长,宽,高"<<endl;
cin>>length;
cin>>width;
cin>>height;
}
float Box::volume()
{
return(length*width*height);
}
void Box::display()
{
cout<<"一个长方体的长为"<<length<<"宽为"<<width<<"高为"<<height<<endl;
}
int main()
{
Box b1;
b1.get_value();
b1.display();
cout<<"该长方体体积为:"<<b1.volume();
return 0;
}
