#include<iostream.h> #include<conio.h> class area { private: int a,r,l,b,a1; public: void getdata(); void sqr(); void crl(); void rec(); }; void area::getdata() { cout<<"\nenter a,b,l,r:"; cin>>a>>b>>l>>r; } void area::sqr() { //int a,a1; //cout<<"\nenter a:"; //cin>>a; a1=a*a; cout<<"\narea of squre:"<<a1; } void area::crl() { //int r,a1; // cout<<"\nenter r:"; //cin>>r; a1=3.14*r*r; cout<<"\narea of circle is:"<<a1; } void area::rec() { //int l,b,a1; //cout<<"\nenter l,b:"; //cin>>l>>b; a1=l*b; cout<<"\narea of rectangle is:"<<a1; } void main() { clrscr(); area x; x.getdata(); x.sqr(); x.crl(); x.rec(); getch(); }
Sunday, 7 December 2014
C++ program to calculate area of square, area of circle and area of rectangle
Posted by Madan
Posted on 14:43