Define a c function that has two 2 integer inputs n and


a): Define a C++ function that has two 2 integer inputs (N) and returns a double output y, where y=∑sqrt(n+0.5)/(2n+1) n=1 the value of n s'd be positive.

b):

i) Read user inputs for N from the command window (console), while ensuring N are positive (>0) integers. If the user enters non-positive numbers, the program should request the user to re-enter a positive (>0) number until a valid number is entered.

ii) Use the above function to determine the value of y for the user inputs N. Display the result using 3 decimal values.

iii) Using the above function and a for loop, display the values of y for N values from 1 to 6 (1,2,3,..,6). Also write the resulting values to a file named "output.txt". Display the result using 3 decimal values in all outputs (file and command windows).

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Define a c function that has two 2 integer inputs n and
Reference No:- TGS01421321

Now Priced at $35 (50% Discount)

Recommended (99%)

Rated (4.3/5)