The square root of any number N>0 can be opproximated by repeated calculation using the formula N - squared_value NG - 0.5 (FG + N/FG) where NG stands for next guess and FG stands for first guess. The value of NG and FG are compared. If the two values are comparably close, then NG is the final answer. If the two values are off, NG becomes FG and the formula is used again to compute FG. After so many iterations, NG and FG will merge. a. Write a function that calculates the square root of a number using this method. The initial guess will be the starting value of FG (FG - 1). The function will compute a value for NG using the formula given and returns that value. (Change the name of the functions to something more meaningful) double fun_1 (double FG, double N); b. Write a function that prompts the user for any number N > 0, and returns that value back. The prototype is like follows: double fun_2 ( void );
The square root of any number N>0 can be opproximated by repeated calculation using the formula N - squared_value NG - 0.5 (FG + N/FG) where NG stands for next guess and FG stands for first guess. The value of NG and FG are compared. If the two values are comparably close, then NG is the final answer. If the two values are off, NG becomes FG and the formula is used again to compute FG. After so many iterations, NG and FG will merge. a. Write a function that calculates the square root of a number using this method. The initial guess will be the starting value of FG (FG - 1). The function will compute a value for NG using the formula given and returns that value. (Change the name of the functions to something more meaningful) double fun_1 (double FG, double N); b. Write a function that prompts the user for any number N > 0, and returns that value back. The prototype is like follows: double fun_2 ( void );
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section: Chapter Questions
Problem 14PP
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning