#include<iostream> #include<math.h> #include<iomanip> using namespace std; int main () { int Geometry_Calculator,Calculate_the_Area_of_a_Rectangle,width,length,Quit,choice; double Calculate_the_Area_of_a_Triangle,base,height; float Calculate_the_Area_of_a_Circle,radius; cout<<"Geometry_Calculator"<<endl; cout<<"1.Calculate_the_Area_of_a_Circle"<<endl; cout<<"2.Calculate_the_Area_of_a_Rectangle"<<endl; cout<<"3.Calculate_the_Area_of_a_Triangle"<<endl; cout<<"4.Quit"<<endl; cout<<"Enter_your_choice (1-4):"<<endl; cin>>choice; switch (choice) { case 1:cout<<fixed<<showpoint; cout<<setprecision (2); cout<<"Enter radius:"; cin>>radius; Calculate_the_Area_of_a_Circle=3.14159*(pow(radius,2)); cout<<"Total_Area_of_a_Cirlce:"<<Calculate_the_Area_of_a_Circle<<endl; break; case 2:cout<<"Enter width:"; cin>>width; cout<<"Enter length:"; cin>>length; Calculate_the_Area_of_a_Rectangle=width*length; cout<<"Total_Area_of_a_Rectangle:"<<Calculate_the_Area_of_a_Rectangle<<endl; break; case 3:cout<<"Enter base:"; cin>>base; cout<<"Enter height:"; cin>>height; Calculate_the_Area_of_a_Triangle=0.5*(base*height); cout<<"Total_Area_of_a_Triangle:"<<Calculate_the_Area_of_a_Triangle<<endl; break; case 4:cout<<"Quit"<<endl; break; default:cout<<"Wrong input.Please try again."<<endl; } system ("pause"); return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)