Using different user-defined functions?

Hello all,
I just started c++ this semester and I'm totally lost now. I did okay in the class up until now but this assignment totally has me confused, I'm not sure where to even begin. Any help would truly be appreciated. Thanks soooo much in advance!


Write a program that have four different functions, main() in addition to three more user-defined functions. The main() function is the one that will invoke all other functions. Appropriate display messages should be used in main() before and after each invocation to indicate that the function is about to be called and the function did return. Each of these function should be stored on a separate file thus your project will have four different C++ files.

The first user-defined function is a void one that basically computes the result of the series below and displays it on the screen in a table format as shown also below. All computation and display must be inside the function. The function should repetitively compute the series for values of I from 1 to 20 (as shown in the table). Once done, the function returns to the calling function, main(). Hint: Function prototype can take the form “void ComputeSeries(void)”.
m(i) = (1/2) + (2/3) + ... + [i/(i+1)]
i m(i)
1 0.5
2 1.1667
...
19 16.4023
20 17.3546

The second function is a value-returning function that uses reference parameters to pass values to the calling module. This function takes the following form “double ComputeTrigonometricValues(int, double&, double&)”. The first argument is the degree which is passed as integer, the second one is a reference parameter the will contain the value of computing the trigonometric sin function upon that degree, the last argument is the value of computing the trigonometric cosine function upon passed degree. The return value of that function is the tangent (tan value) of the same degree. The mere task of this function is to receive a degree from main() then compute and return back to the caller the values for sin, cos, and tan of that degree. The main() function is in charge of repeatedly calling that function, ComputeTrigonometricValues(), in order to display on the screen the table shown below.
degree sin cos tan
0 0.0 1.0 0.0
10 0.1736 0.9848 0.1763
...
350 -.01736 0.9848 -0.1763
360 0.0 1.0 0.0

The last function is a value returning function that has the form “double ComputeSquareRoot(double num) and uses passing-by-value to communicate the values in which we need to compute its square root. This function does NOT use the standard sqrt() library function to compute the square root instead it uses the following approximation.
The square root of a number, num, can be approximated by ‎repeatedly performing a calculation using the following ‎formula:‎
nextGuess = (lastGuess + (num / lastGuess)) / 2‎
The initial guess can be any positive value (e.g., 1). This ‎value will be the starting value for lastGuess. If the ‎difference between nextGuess and lastGuess is less than a ‎very small number, such as 0.0001, you can claim that ‎nextGuess is the approximated square root of num. If not, ‎nextGuess becomes the lastGuess and continue the ‎approximation process.‎ Hint: this algoeithm can be implemented with while loop(s)

Once the function is over, it will return the value of the computed square root to the calling module, main(). Also, main() is in charge of repeatedly calling the function to compute the square root for (0, 10, 20, 30, ….. 100) and put them in tabular format shown below. In addition, main() should display in the third column of that table the value of the computed square root for that given number but now using the sqrt library function found in the cmath header file.
num sqrt() ComputeSquareRoot
0 0.0
10
...
90
100 10.0
well you need to have something done, post it here so we can get a look at it...
Man, we don't have anything to start with post some code first so we can see what's the problem
you should get you hand typing..
first try to understand the porblem first okay see what variables you need as input and what will be your output and declare you functions and what each function task will be ....
Topic archived. No new replies allowed.