#include<iostream.h>
#include<conio.h>
#include<math.h>
#define PI 3.14
class shape {
public:
float ar,ar2,ar3,s;
float area(int r) {
ar=PI*r*r;
return(ar);
}
float area(int l, int b) {
ar2= l* b;
return(ar2);
}
float area(int a, int b, int c) {
s=(a+b+c)/2.0;
ar3=sqrt(s*(s-a)*(s-b)*(s*c));
return(ar3);
}
void Display();
};
void shape :: Display() {
cout<<"\n\n\t\tArea of Circle... "<<ar;
cout<<"\n\t\tArea of Rectangle.... "<<ar2;
cout<<"\n\t\tArea of Triangle..... "<<ar3;
}
void main() {
clrscr();
shape s;
cout.precision(2);
s.area(5);
s.area(6,5);
s.area(5,3,4);
s.Display();
getch();
}
OUTPUT:
Area of Circle... 78.5
Area of Rectangle.... 30
Area of Triangle..... 20.78
0 comments:
Post a Comment