// Solving ax^2 + bx + c = 0 for a=1, b=3, c=-4 #include #include using namespace std; double a, b, c; double D, x1, x2; int main() { a = 1.; b = 3.; c = -4.; D = b*b-4.*a*c; // determinant x1 = (-b + sqrt(D))/(2.*a); // 1st root x2 = (-b - sqrt(D))/(2.*a); // 2nd root cout << x1 << " " << x2 << endl; // " " encloses a string of character(s) }