#include "library.h" double ask(const string question) { print(question); return read_double(); } void main() { const double A = ask("Enter A: "); const double B = ask("Enter B: "); const double C = ask("Enter C: "); const double disc = B*B - 4*A*C; if (disc < 0) print("There is no solution\n"); if (disc == 0) { const double x = -B / (2*A); print("x = "); print(x); new_line(); print("This should be almost zero: "); print(A*x*x + B*x + C); new_line(); } if (disc > 0) { const double x1 = (-B - sqrt(disc)) / (2*A); print("x1 = "); print(x1); new_line(); print("This should be almost zero: "); print(A*x1*x1 + B*x1 + C); new_line(); const double x2 = (-B + sqrt(disc)) / (2*A); print("x2 = "); print(x2); new_line(); print("This should be almost zero: "); print(A*x2*x2 + B*x2 + C); new_line(); } }