I am writing a program that uses only functions to do everything. Unfortunatly I am not seeing why I am getting so many errors, and yes all of this must be done with functions
int main ()
{
func1(double base, double height);
func2(double theta, double hypotenuse);
func3;
system("PAUSE");
return 0;
}
//Functions
//Function one is giving the commands and checking that x != 0
//It is also going to pass the parameters as funcA and funcB
//(base, height)
void func1(double& funcA, double& funcB)
{
cout << "Please enter X coordinate. This cannot be 0. \n";
cin >> base;
do
{
cout << "Please re-enter X coordinate. This cannot equal 0. \n";
cin >> base;
}while (base == 0);
cout << "Please enter the Y coordinate.\n";
cin >> height;
void return;
}
//Function 2 will take funcA and funcB, do the equations
//and pass the Polar coordinates to the funcC and funcD
//respectivly.
void func2(funcA, funcB,double& funcC, double& funcD)
{
hypotenuse = sqrt (funcA * funcA + funcB * funcB);
theta = atan (funcB / funcA) * conversionFactor;
void return;
}
//Function 3 will send the Polar coordinates to the user.
void func3(funcC, funcD)
{
cout << "The polar coordinates are: \n";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(3);
cout << "Distance from origin = " << funcC << endl;
cout << "Angle (in degrees) from the x-axis = " << funcD << endl;
void return;
}
when you call a function you always have to put parentheses after it.
If the function needs some arguments, you have to give values in the paretheses.
You missed some identifiers on the implementation of your functions.