I'm a little confused on this program. Would I need to include another statement?
/*
Program: repair1a - program prompts for run and sine, displays the rise
Examples:
if run is 4 and sine is .707, rise is 3.999
if run is 5 and sine is .9, rise is 10.234
Fix the function, do not change main or
change the statements already in the function
*/
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;
double rise_sine(run, sine);
int main(void)
{
double run, sine;
cout << "Enter run and sine: ";
cin >> run >> sine;
cout << fixed << setprecision(3);
cout << "The rise is: " << rise_sine(run, sine) << endl;
return 0;
}
double rise_sine(run, sine)
{
double rise;
rise = run * (sine / (sqrt(1 - sine * sine)) );
}
You certainly need to return a value from your function: return rise;
You need to add variable types in both the function prototype double rise_sine( double run, double sine);
and also in the subsequent function definition.
In C++ it is int main()
(i.e. you don't need the "void").
I suggest that you use #include <cmath>
rather than math.h