#include<iostream> |
using namespace std; |
class Cubic{ |
private : |
double length,width,height; |
public : |
void set_length( void ){ |
cout<< "Please enter the length of the cubic: " ; |
cin>>length; |
} |
void set_width( void ){ |
cout<< "Please enter the width of the cubic: " ; |
cin>>width; |
} |
void set_height( void ){ |
cout<< "Please enter the height of the cubic: " ; |
cin>>height; |
} |
void get_volume( void ){ |
cout<<length*width*height<<endl; |
} |
}; |
int main(){ |
Cubic c1,c2,c3; |
cout<< "First cubic:\n" ; |
c1.set_length(); |
c1.set_width(); |
c1.set_height(); |
cout<< "Second cubic:\n" ; |
c2.set_length(); |
c2.set_width(); |
c2.set_height(); |
cout<< "Third cubic:\n" ; |
c3.set_length(); |
c3.set_width(); |
c3.set_height(); |
cout<< "The volume:\n" ; |
c1.get_volume(); |
c2.get_volume(); |
c3.get_volume(); |
return 0; |
} |
by: 发表于:2017-09-01 09:54:58 顶(0) | 踩(0) 回复
??
回复评论