// Michael Molitor, Program1, 3/4/15 //
//This program will be able to have the user choose from the menu and decide which equation to perform.//
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
const double pi = 3.14159;
double radius, height, base, x, y;
double hyp, Ac, Vp, Vs, Vc;
// where hyp is hypotenuse, Ac is area of a circle, Vp is volume of a pyramid, Vs is volume of a sphere, and Vc is volume of a cone. //
int input;
cout << " Choose a number 1-5 based on what you want to calculate.\n.";
cout << " 1.)Calculate Volume of a cone. \n.";
cout << " 2.)Calculate the volume of a sphere. \n.";
cout << " 3.)Calculate the hypotenuse of a right triangle. \n.";
cout << " 4.)Calculate the Volume of a pyranid with a square base. \n.";
cout << " 5.)Calculate the area of a cirle. \n.";
cin >> input;
switch (input)
{
case 1:
cout << " please enter the radius in inches of the cone. \n.";
cin >> radius;
cout << "please enter the height of the cone in inches \n.";
cin >> height;
// The volume of the cone equation. //
Vc = ( 1.0 / 3.0 ) * pi * pow(radius,2) * height;
cout << "The volume of the cone is: " << Vc << " inches^3. \n\n";
break;
case 2:
cout << " Please enter the radius of the sphere in inches. \n.";
cin >> radius;
// The volume of the sphere equation. //
Vs = ( 4.0 / 3.0 ) * pi * pow(radius,3);
cout << "The volume of the sphere is:" << Vs << "inches^3. \n\n";
break;
case 3:
cout << " Please enter the the value of the one of the legs in inches \n";
cin >> x;
cout << " please enter the value of the other leg in inches. \n";
cin >> y;
//The equation to find the hypotenuse.//
hyp = sqrt(pow(x,2) * pow(y,2));
cout << "The value of the hypotenuse is:" << hyp << "inches^2 \n\n";
break;
case 4:
cout << " please enter the base of the pyramid in inches \n";
cin >> base;
cout << " please enter the value of the of the height in inches \n.";
cin >> height;
// The equation of the volume of the pyramid. //
Vp = ( 1.0 / 3.0 ) * base * height;
cout << "The volume of the pyramid is" << Vp << "inches^3 \n.";
break;
case 5:
cout << " please enter the radius of the circle in inches \n.";
cin >> radius;
//The equation of area of a circle.//
Ac = pi * pow(radius,2);
cout << " The area of the circle is:" << Ac << " inches^2 \n";