Advertisement
mahmud_bhai

clss

Mar 25th, 2020
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class box{
  5. public:
  6. double length;
  7. double width;
  8. double height;
  9. double volume;
  10. double a;
  11. };
  12. int main()
  13. {
  14. box box1;
  15. box box2;
  16.  
  17. box1.height = 5.0;
  18. box1.width = 6.0;
  19. box1.length = 7.0;
  20.  
  21. box2.height = 10.0;
  22. box2.length = 12.0;
  23. box2.width = 13.0;
  24.  
  25. box1.a = 2*((box1.height*box1.length) + (box1.length*box1.width) + (box1.height*box1.width));
  26. box1.volume = box1.height*box1.length * box1.width;
  27. cout << "Volume of box1 : " << box1.volume <<"area"<<box1.a<< endl;
  28. box2.a = 2*((box2.height*box2.length) + (box2.length*box2.width) + (box2.height*box2.width));
  29. box2.volume = box2.height*box2.length * box2.width;
  30. cout << "Volume of box2 : " << box2.volume <<"AREA:"<<box2.a<< endl;
  31.  
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement