Maximum and Minimum value of a quadratic function | C ++ implementation of the above approach ; Function to print the Maximum and Minimum values of the quadratic function ; Calculate the value of second part ; Print the values ; Open upward parabola function ; Open downward parabola function ; If a = 0 then it is not a quadratic function ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void PrintMaxMinValue ( double a , double b , double c ) { double secondPart = c * 1.0 - ( b * b / ( 4.0 * a ) ) ; if ( a > 0 ) { cout << " Maxvalue ▁ = ▁ " << " Infinity STRNEWLINE " ; cout << " Minvalue ▁ = ▁ " << secondPart ; } else if ( a < 0 ) { cout << " Maxvalue ▁ = ▁ " << secondPart << " STRNEWLINE " ; cout << " Minvalue ▁ = ▁ " << " - Infinity " ; } else { cout << " Not ▁ a ▁ quadratic ▁ function STRNEWLINE " ; } } int main ( ) { double a = -1 , b = 3 , c = -2 ; PrintMaxMinValue ( a , b , c ) ; return 0 ; }