Question: Please fill the code for C++ ---------------------------------------------------------------------------------------------- #include #include #include // for time #include // for fabs() and other functions in f() using namespace std;
Please fill the code for C++ ---------------------------------------------------------------------------------------------- #include#include #include // for time #include // for fabs() and other functions in f() using namespace std; // FILL IN THE CODE for the prototype of the bisection function. Make the last two parameters have the default value of 1E-5 and 100, respectively int main() { double a,b; // endpoints double tol; int n0; cout << "Enter endpoints a and b surrounding solution: "; cin >> a >> b; if(a>b){ cout << "Error: invalid endpoints "; return 1; } cout << "Enter tolerance: "; cin >> tol; if(tol<=0){ cout << "Error: invalid tolerance "; return 1; } cout << "Enter maximum number of iterations: "; cin >> n0; if(n0<=0){ cout << "Error: invalid number of iterations "; return 1; } // Call Bisection function double p = bisection(a, b, tol, n0); // Output results cout << "A zero was found at p = "<
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
