C programming A brief description of the inputs and outputsS

C++ programming:
A brief description of the inputs and outputs

Solution

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int shape;
cout<<\"\ Shape Menu \ 1.Circle\ 2.Rectangle \ 3.Triangle \ Shape (1,2 or 3) ? :\";
cin>>shape;
switch(shape)
{
case 1:
cout<<\"\ enter radius : \";
double r;
cin>>r;
cout<<\"\ area of circle is \"<<3.14*r*r<<\" square units \";
break;
case 2:
cout<<\"\ enter length : \";
double l;
cin>>l;
cout<<\"\\ n enter breadth :\";
double b;
cin>>b;
cout<<\"\ area of rectangle is \"<<l*b<<\" square units \";
break;
case 3:
double s,a,b,c,area;
cout<<\"\ enter a :\";cin>>a;
cout<<\"\ enter b:\";cin>>b;
cout<<\"\ enter c :\";cin>>c;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<\"\ area of triangle :\"<<area;
break;
default:
cout<<\"\ invalid choice\";
}
return 0;
}

C++ programming: A brief description of the inputs and outputsSolution#include<iostream> #include<cmath> using namespace std; int main() { int shape

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site