Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write the answer for this program quicly and i\'ll rate you good. Write a functi

ID: 3533846 • Letter: W

Question

write the answer for this program quicly and i'll rate you good.

Write a function fraction (double x) which computes a value of the rational function 2x2 + x + 3/x - 1 and return the result. Then write a main function to input a number with type double from keyboard, call the fraction function to compute the rational unction and print the message "The answer as aa, aaaa" where aa.aaaa is the return value (a real number) of the function. Note that the input data cannot be x = 1 or very close to 1. So you may add a condition: if 0.99999 x 1.00001 then print the message "Out of domain".

Explanation / Answer

#include <iostream>

#include<math>

using namespace std;

double func(double x)

{

double result;

result =(2*pow(x,3)+x+3)/(x-1);

return result;

}

int main()

{

cout<<"Enter the value of x ";

double x,result;

cin>>x;

if (x>=0.99999 && x<=1.00001)

cout<<"The value of x out of range ";

else

{

result=func(x);

cout<<"The result of the fraction is "<<result<<endl;

system("pause");

}

return 0;

}