SHARE
TWEET

n vnmvcn

a guest Feb 19th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top