#include<iostream>
#include<cmath>
#include<cstdlib>
# define PI 3.14
using namespace std;
void menu();
void area_circle();
void area_rectangle();
void area_triangle();
int option;
float AREA;
int main()
{
//int option;
menu();
switch (option)
{
case 1:
area_circle();
break;
case 2:
area_rectangle();
break;
case 3:
area_triangle();
break;
}
cout<<"area is" <<endl<<AREA;
}
void menu()
{
//float a,b,c, AREA;
cout<<"1 :circle"<<endl;
cout<<"2 :rectangle"<<endl;
cout<<"3 :triangle"<<endl;
cout<<"your option"<<endl;
cin>>option;
//cout<<"the area is "<<AREA;
}
void area_circle()
{
int R;//,AREA;
cout<<"enter the radius";
cin>>R;
AREA=PI*R*R;
}
void area_rectangle()
{
float a,b;//,AREA;
cout<<"enter the width and height"<<endl;
cin>>a>>b;
AREA=a*b;
}
void area_triangle()
{
float s,a,b,c;//,AREA;
cout<<"enter the side of the triagle"<<endl;
cin>>a>>b>>c;
s=(a+b+c)/2.0;
AREA=s*(s-a)*(s-b)*(s-c);
AREA=sqrt(AREA);
}
#include<cmath>
#include<cstdlib>
# define PI 3.14
using namespace std;
void menu();
void area_circle();
void area_rectangle();
void area_triangle();
int option;
float AREA;
int main()
{
//int option;
menu();
switch (option)
{
case 1:
area_circle();
break;
case 2:
area_rectangle();
break;
case 3:
area_triangle();
break;
}
cout<<"area is" <<endl<<AREA;
}
void menu()
{
//float a,b,c, AREA;
cout<<"1 :circle"<<endl;
cout<<"2 :rectangle"<<endl;
cout<<"3 :triangle"<<endl;
cout<<"your option"<<endl;
cin>>option;
//cout<<"the area is "<<AREA;
}
void area_circle()
{
int R;//,AREA;
cout<<"enter the radius";
cin>>R;
AREA=PI*R*R;
}
void area_rectangle()
{
float a,b;//,AREA;
cout<<"enter the width and height"<<endl;
cin>>a>>b;
AREA=a*b;
}
void area_triangle()
{
float s,a,b,c;//,AREA;
cout<<"enter the side of the triagle"<<endl;
cin>>a>>b>>c;
s=(a+b+c)/2.0;
AREA=s*(s-a)*(s-b)*(s-c);
AREA=sqrt(AREA);
}
No comments:
Post a Comment