I'm trying to teach myself C++ through internet tutorials and such. Right now I'm trying to write a program that find the diameter and radius of a circle if the circumference is entered, and does the same if one of the other two measurements is entered instead. I'm using switch/case to do this. It won't even compile right, so help me find out what I did wrong, please. I'm hoping it's something basic that will make me put my face through the desk when someone points it out, rather than an error with the design, which is also very possible. :\
#include <iostream>
using namespace std;
float radius ( float r, float d, float c );
float diamter ( float r, float d, float c);
float circumference ( float r, float d, float c);
int main()
{
float r, d, c;
int In;
cout<<"Enter one of a circle's measurements. \n";
cout<<"1 - radius \n";
cout<<"2 - diameter \n";
cout<<"3 - circumference \n";
cin>> In;
switch ( In ) {
case 1:
radius();
case 2:
diameter();
case 3:
circumference();
default:
cout<<"Bad input. \n";
}
cin.get();
}
float radius ( float r, float d, float c )
{
cin>> r;
return d * 2 * r, 2 * 3.14 * r;
}
float diameter ( float r, float d, float c)
{
cin>> d;
return d / 2, 3.14 * d;
}
float circumference (float r, float d, float c )
{
cin>> c;
return c / 3.14, c / 2 / 3.14
}