Our assignment is to write a program that calculates the volume of three geometric shapes, the program should ask for a shape and the three shapes we are to use is a dumbell, axle, spear. And he gives us the formulas for volume and how to find it. I know that I need to write a if /else statement and so if its dumbell to calculate the volume using the given formulas and if it is not to go to next if statement.
so far I have:
int main()
{
time_t t;
time(&t);
yl;
cls;
char shape, dumbell, axle, spear;
double radius, radius2, width, length, heigth, volume;
double pi = 3.14159;
cout << "Give me a Geometric Shape " << endl;
cin >> shape;
if (shape == dumbell){
cout << "What is the Radius of the Sphere? " << endl;
cin >> radius;
cout << "What is the Radius and Length of the Rod? " << endl;
cin >> radius2 >> length;
cout << fixed << showpoint << setprecision (3);
}
else
if(shape == axle)
cout << "What is the Radius of the Rod? " << endl;
else
if(shape == spear)
cout << "What is the Radius of the Cone? " << endl;
frz;
return 0;
} // end of main function
and so far when i run the program it says the firs question "give me a geometric shape?,, but i type dumbell, and it just skips to "What is the Radius and Length of the rod" and then quits the program. but I want to stop and wait for dumbell adn then go to the next question and wait for an answer.
\
Any help would be greatly appreciated.