Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- class area
- {
- public:
- double r,ht,l,b,a,ba;
- double circle()
- {
- return (3.14*r*r);
- }
- double triangle()
- {
- return ((ba*ht)/2);
- }
- double cube()
- {
- return (a*a*a);
- }
- double rect()
- {
- return (l*b);
- }
- };
- int main()
- {
- area x;
- cout<<"enter the following data:\n";
- cout<<"radius:\n";
- cin>>x.r;
- cout<<"height and base value of triangle:\n";
- cin>>x.ht>>x.ba;
- cout<<"side if a cube\n";
- cin>>x.a;
- cout<<"lenght and breadth of a rectangle':\n";
- cin>>x.l>>x.b;
- cout<<"the are of the geometrical figures are:\n";
- cout<<"area of circle: "<<x.circle()<<endl;
- cout<<"area of triangle: "<<x.triangle()<<endl;
- cout<<"area of cube: "<<x.cube()<<endl;
- cout<<"area of rectangle: "<<x.rect()<<endl;
- return 0;
- }
- OUTPUT:
- enter the following data:
- radius:
- 5
- height and base value of triangle:
- 4
- 12
- side if a cube
- 2
- lenght and breadth of a rectangle':
- 10
- 5
- the are of the geometrical figures are:
- area of circle: 78.5
- area of triangle: 24
- area of cube: 8
- area of rectangle: 50
- Press any key to continue
Advertisement
Add Comment
Please, Sign In to add comment