第八章第6小题
#include <iostream>
using namespace std;
class volume
{
public:
void get_dota();
int volume_result();
private:
int l;
int w;
int h;
};
int volume::volume_result()
{
return l*w*h;
}
void volume::get_dota()
{
cin>>l>>w>>h;
}
int main()
{
volume t1,t2,t3;
cout<<"请分别输入三个长方体的长,宽,高:"<<endl;
t1.get_dota();
t2.get_dota();
t3.get_dota();
cout<<"这三个长方体的体积分别是:"<<endl;
cout<<" "<<t1.volume_result()<<" "<<t2.volume_result()<<" "<<t3.volume_result()<<endl;
return 0;
}