#include "library.h" void solve_quadratic(double a, double b, double c) { const double det = b*b - 4*a*c; if (det < 0) print("no solutions"); else if (det == 0) { print("solution is "); print(-b / (2*a)); } else { const double sqrtdet = sqrt(det); print("solution one is "); print((-b - sqrtdet) / (2*a)); new_line(); print("solution two is "); print((-b + sqrtdet) / (2*a)); } new_line(); } void test_once() { print("Enter A "); const double a = read_double(); print("Enter B "); const double b = read_double(); print("Enter C "); const double c = read_double(); solve_quadratic(a, b, c); } void many_tests() { test_once(); print("do you want another test (y for yes)? "); const string reply = read_string(); if (reply == "y") many_tests(); } void main() { many_tests(); }