Write a program which will compute square roots to a


Question 1: You are to write a program which will compute square roots to a desired degree of accuracy.

Begin the program by prompting the user for two numbers: (1) the value for which to determine the square root and (2) the number of decimal places of accuracy desired in the result. For example, find the square root of 7 to four decimal places; the actual value is 2.6458.

On each pass of the inner event-controlled loops, display the current value of ?, the current approximation to the square root, and the error associated with the approximation.

Recall that the iomanip library contains manipulators to format output. At some point prior to the count-controlled loop, use fixed and setprecision(p) to show that floating point results should be displayed in a fixed number format, (nn.nnn and notn.nnE+nn), and that p decimal positions should be shown, even if all are trailing zeroes.

This need only be done once as fixed and setprecision will remain in effect until reset.

Use setw(w) to display a value in a total of w columns; this must be done for each individual value.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a program which will compute square roots to a
Reference No:- TGS0958428

Expected delivery within 24 Hours