Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class box{
- public:
- double length;
- double width;
- double height;
- double volume;
- double a;
- };
- int main()
- {
- box box1;
- box box2;
- box1.height = 5.0;
- box1.width = 6.0;
- box1.length = 7.0;
- box2.height = 10.0;
- box2.length = 12.0;
- box2.width = 13.0;
- box1.a = 2*((box1.height*box1.length) + (box1.length*box1.width) + (box1.height*box1.width));
- box1.volume = box1.height*box1.length * box1.width;
- cout << "Volume of box1 : " << box1.volume <<"area"<<box1.a<< endl;
- box2.a = 2*((box2.height*box2.length) + (box2.length*box2.width) + (box2.height*box2.width));
- box2.volume = box2.height*box2.length * box2.width;
- cout << "Volume of box2 : " << box2.volume <<"AREA:"<<box2.a<< endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement