I recently added a new function to calculate a volume of a cone, eventually looking to do another for the area, i cant seem to get it to work though,ive played around with it but still keep getting build errors,here is the code along with that the header file includes:
#include "testtwo"
#include <cmath>
#include <iostream>
usingnamespace std;
// function prototype
void menu();
mysecondclass myshape;
int main ()
{
menu();
return 0;
}
void menu()
{
float lengthone,lengthtwo,volume, area, r, h;
int imenu;
cout << "Geometry Menu \n \n";
cout << "1. Area of a Cube \n";
cout << "2. Volume of a Cube \n";
cout << "3. Volume of a Cone \n";
cout << "4. Exit \n";
cout << "Please enter the number of your selection \n";
cin >> imenu;
switch(imenu)
{
case 1:
cout << "Please enter the lenght of the cube\n";
cin >> lengthone;
area = myshape.areaofcube(lengthone);
cout << "The area of that cube is " << area << "\n";
cout << " \n";
menu();
break;
case 2:
cout << "Please enter the lenght of the cube\n";
cin >> lengthtwo;
area = myshape.volumeofcube(lengthtwo);
cout << "The volume of that cube is " << area << "\n";
cout << " \n";
menu();
break;
case 3:
cout << "Please enter the radious of the cone base\n";
cin >> r;
cout << "Please enter the height of the cone\n";
volume = myshape.volumeofcone(r,h);
cout << "The volume of that cone is " << volume << "\n";
cout << " \n";
menu();
break;
case 4:
return; // go back to main
break;
default:
cout << "Please make a valid choice \n";
menu(); // call this function again to display the menu again
} // end of switch
}