Anda di halaman 1dari 3

#include<conio.h> #include<iostream.h> class circle { public: int r; float ac; void cir() { cout<<"\n\nEnter the radius:\n"; cin>>r; ac=(3.

14*r*r); } }; class rectangle { public: int l,b,ar; void rec() { cout<<"\n\nEnter the length and width of the rectangle:\n";

cin>>l>>b; ar=(l*b); } }; class square { public: int s,as; void sqr() { cout<<"\n\nEnter the side of the square:\n"; cin>>s; as=(s*s); } }; class display:public circle,public rectangle,public square { public: void show() { cout<<"\n\nThe area of the circle is :"<<ac; cout<<"\n\nThe area of the rectangle is :"<<ar; cout<<"\n\nThe area of the square is :"<<as; } };

void main() { clrscr(); display d; d.cir(); d.rec(); d.sqr(); d.show(); getch(); }

Anda mungkin juga menyukai