**************************************************************/ /*include file..
ID: 3654690 • Letter: #
Question
**************************************************************/ /*include file...*/ #include using namespace std; //function prototype Enter the function prototype for the function Quadratic int main() { //local variables float a, b, c; //coefficients of ax^2 + bx + c float x; //value at which the quadratic will be evaluated float answer; //value of the quadratic function //Program starting cout <<" Program starting.... "; //Read values in order of a, b, c ,x cin >> a >> b >> c >> x; //Evaluate the quadratic function given 3 coefficients and x value. Call function Quadratic using values a, b, c, and x to find the answer //display result cout <<"The quadratic function "<< a <<"x^2 + " << b <<"x + "<< c <<" has a function value of " << answer <<" when x = "<< x <<endl; //End program cout<<"End program..."<<endl; return 0; } /********************************************************** Function: Quadratic Purpose : Evaluate a quadratic function ax^2+bx+c Precondition : 4 floating point input values (a, b, c, and x) are provided Postcondition: evaluation of the function using input values is returned ***********************************************************/ float Quadratic(float a, //IN: coefficient of the quadratic float b, //IN: coefficient of the quadratic float c, //IN: coefficient of the quadratic float x) //IN: the value of x { // local variables... float answer; //The value of the quadratic //evaluate and return the value of the quadratic function answer = a * x * x + b * x + c; return answer; }Explanation / Answer
#include#include#includeint main(){ float a,b,c,alf,bt,dlt; clrscr(); printf(" Enter a: "); scanf("%f",&a); printf(" Enter b: "); scanf("%f",&b); printf(" Enter c: "); scanf("%f",&c); dlt=b*b-4*a*c; if(dlt==0) { printf(" ALPHA=BETA=%f",-b/(2*a)); } elseif(dlt0]{x1=[-b+sqrt (b*b-4*a*c)]/(2*a);x2=[-b-sqrt (b*b-4*a*c)]/(2*a);printf("the roots are x1=%f,x2=%f",x1,x2);}elseprintf("it has imaginary roots");getch();}Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.