#include<iostream.h>
#include<conio.h>
#include<math.h>
void area(int a)
{
cout<<"Area of Square"<<a*a;
}
void area(int l,int b)
{
cout<<"Area of rectangle"<<l*b;
}
void area(int a,int b,int c)
{
float s,ar;
s=(a+b+c)/2.0;
ar=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"Area of triangle"<<ar;
}
void main()
{
int op,a,b,c;
cout<<"1.Area of Square";
cout<<"\n2.Area of Rectangle";
cout<<"\n3.Area of Triangle";
cout<<"\nEnter your option";
cin>>op;
switch(op)
{
case 1:
cout<<"Enter Side";
cin>>a;
area(a);
break;
case 2:
cout<<"Enter length and breadth";
cin>>a>>b;
area(a,b);
break;
case 3:
cout<<"Enter Sides of a triangle";
cin>>a>>b>>c;
area(a,b,c);
break;
default:
cout<<"Invalid Option";
}
getch();
}
#include<conio.h>
#include<math.h>
void area(int a)
{
cout<<"Area of Square"<<a*a;
}
void area(int l,int b)
{
cout<<"Area of rectangle"<<l*b;
}
void area(int a,int b,int c)
{
float s,ar;
s=(a+b+c)/2.0;
ar=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"Area of triangle"<<ar;
}
void main()
{
int op,a,b,c;
cout<<"1.Area of Square";
cout<<"\n2.Area of Rectangle";
cout<<"\n3.Area of Triangle";
cout<<"\nEnter your option";
cin>>op;
switch(op)
{
case 1:
cout<<"Enter Side";
cin>>a;
area(a);
break;
case 2:
cout<<"Enter length and breadth";
cin>>a>>b;
area(a,b);
break;
case 3:
cout<<"Enter Sides of a triangle";
cin>>a>>b>>c;
area(a,b,c);
break;
default:
cout<<"Invalid Option";
}
getch();
}