Needs help with my C++ code calculating Volumes with functions.?

Code:

`You will write a C++ program that calculates the volume of spheres or cubes based on user input. You will write C++ functions to calculate the volumes, and you will call these functions from your main() program.`

First your program will ask the user to enter 's' if they want to calculate the volume of a sphere, 'c' if they want the volume of a cube, or 'q' if they want to quit.

If they enter 's', the program will prompt the user to enter the radius of the sphere. Your program will pass this value to your sphereVolume() function, which will return the answer so you can then display to the user from main().

Similarly, if they enter 'c' the program will prompt the user to enter the height of the cube, then call

your cubeVolume() function to find the volume. The function will return the answer, and in main(),

you will display it to the user.

After displaying the answer, your program should loop to the beginning, and continue like this until the user enters 'q' to quit.

Remember,

volume of a cube = height^3

volume of sphere = (4/3) * PI * r^3

My code is:

# include <iostream>

# include <cmath>

using namespace std;

int main ()

{

double cubeVolume(double height);

double h = pow(h,3);

double sphereVolume(double radius);

double PI = 3.14159;

double r = pow(r,3);

cout << "sphereVolume is (4.0 / 3.0) * PI * pow(h,3) ";

}

{

question:

cout << "Do you want to calculate the volume of a sphere or cube(s/c)? (q for quit) ";

char i;

cin >> i;

double result;

if (i=='s')

{

cout << "Enter the sphere's radius: ";

double getradius;

cin >> getradius;

cout << "The sphere's volume is " << sphereVolume(getradius) <<".\n";

}

if (i=='c')

{

cout << "Enter the cube's height: ";

double getheight;

cin >> getheight;

cout << "The cube's volume is " << cubeVolume(getheight) << ".\n";

}

if (i!='c' && i!='s' && i!='q')

{

cout << "Invalid answer. s, c, or q please.\n";

goto question;

}

if (i!='q')

goto question;

return 0;

}}