Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- class box {
- public:
- int width, height, lenght;
- void calculatevolume() {
- cout << "volume is : " << width * lenght * height ;
- }
- };
- int main () {
- box b1,b2;
- b1.width=10;
- b1.height=5;
- b1.lenght=2;
- b2.width=5;
- b2.height=10;
- b2.lenght=1;
- b1.calculatevolume();
- b2.calculatevolume();
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement