Advertisement
Guest User

n vnmvcn

a guest
Feb 19th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. class box {
  5.  public:
  6.     int width, height, lenght;
  7.     void calculatevolume() {
  8.          cout << "volume is : " << width * lenght * height ;
  9.     }
  10.  
  11.  
  12.  
  13. };
  14. int main () {
  15.  
  16.     box b1,b2;
  17.  
  18.     b1.width=10;
  19.     b1.height=5;
  20.     b1.lenght=2;
  21.  
  22.     b2.width=5;
  23.     b2.height=10;
  24.     b2.lenght=1;
  25.  
  26.  
  27.     b1.calculatevolume();
  28.     b2.calculatevolume();
  29.  
  30.     return 0 ;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement