Prompt the user for 3 numbers a b and c as part of the quadr
Solution
#include <iostream>
 #include <cmath>
 using namespace std;
 bool calculateQuadric();
int main() {
    bool val;
    val=calculateQuadric();
 return 0;
 }
bool calculateQuadric()
 {
    float a, b, c, determinant;
    float root1, root2;
 cout<<\"Enter a: \";
 cin>>a;
    cout<<\"Enter b: \";
 cin>>b;
    cout<<\"Enter c: \";
 cin>>c;
 determinant = b*b - 4*a*c;
   
    if(a==0)
    {  
        cout<<\"There are no real roots\ \";
        return false;
    }
    else
    {
        if (determinant > 0) {
                root1 = (-b + sqrt(determinant)) / (2*a);
                root2 = (-b - sqrt(determinant)) / (2*a);
                cout <<\"\ There are two real roots and they are \"<<root1<<\" and \"<<root2<<endl;  
                return true;          
    }
   
    else if (determinant == 0) {
            root1 = (-b + sqrt(determinant)) / (2*a);
                cout <<\"\ There is 1 real root and it is \"<<root1<<endl;
                return true;
        }
           
        else {
    //cout << \"There are two complex roots as the discriminant is negative\" << endl;
    return false;
    }
    }
 }

