#include <iostream>
using namespace std;
class Rp
{
public:
void set_ckg();
void calculate_va();
void show_va();
private:
struct Cfz
{
int length;
int width;
int height;
int volume;
int areas;
}cfz1,cfz2,cfz3;
};
Rp r;
int main()
{
r.set_ckg();
r.calculate_va();
r.show_va();
return 0;
}
void Rp::set_ckg()
{
cout<<"分别输入3个长方柱的长、宽、高:";
cin>>cfz1.length>>cfz1.width>>cfz1.height;
cin>>cfz2.length>>cfz2.width>>cfz2.height;
cin>>cfz3.length>>cfz3.width>>cfz3.height;
}
void Rp::calculate_va()
{
cfz1.volume=cfz1.length*cfz1.height*cfz1.width;
cfz1.areas=2*cfz1.length*cfz1.width+2*cfz2.length*cfz1.height+2*cfz1.height*cfz1.width;
cfz2.volume=cfz2.length*cfz2.width*cfz2.height;
cfz2.areas=2*cfz2.length*cfz2.width+2*cfz2.length*cfz2.height+2*cfz2.height*cfz2.width;
cfz3.volume=cfz3.length*cfz3.width*cfz3.height;
cfz3.areas=2*cfz3.length*cfz3.width+2*cfz3.length*cfz3.height+2*cfz3.height*cfz3.width;
}
void Rp::show_va()
{
cout<<"3个长方柱的体积分别是:"<<endl;
cout<<cfz1.volume<<" "<<cfz2.volume<<" "<<cfz3.volume<<endl;
cout<<"3个长方柱的面积分别是:"<<endl;
cout<<cfz1.areas<<" "<<cfz2.areas<<" "<<cfz3.areas<<endl;
}