Question: Programming language is C++. The code for problem 2 is posted below. Show finished code and an example of the output on PuTTY when done.

Programming language is C++. The code for problem 2 is posted below. Show finished code and an example of the output on PuTTY when done. Use g++ -std=c++17 -Wall -Wextra -pedantic -fsanitize=address,undefined to compile the code on PuTTY.

Programming language is C++. The code for problem 2 is posted below.

#include #include #include

using namespace std;

/* Calculate cube root using Pade approximation */ double my_cbrt_l(double n) {

double numerator = (101.639 * n * n) + (207.953*n) + 29.7541; double denominator = (-1 * n * n *n) + (42.945* n *n) + (215.165* n) + 92.1357;

double result = numerator / denominator;

return result; }

int main(void) {

double n;

cout

for (auto k : { -100,-10,-1,0,1,10,100 }) { n = M_PI * pow(10.0, k); cout

3. (20 points Modify problem 2 to also print the relative error as a per cent, by adding a column. relative error per cent 100 my cbrt i(n)-cbrt(n) cbrt(n). Line up the columns using setw0, etc. Name your program hw2pr3.cpp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!