/****************************************************************************** * This program computes the roots of quadratic equations * of the form Ax^2 + Bx + C = 0 * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #include #include #include #include #include std::locale utf8loc(std::locale(), new std::codecvt_utf8); using namespace std; static double const A = 2.0; static double const B = 4.0; static double const C = 1.0; int main(int argc, char **argv) { setlocale(LC_ALL, "en_US.UTF-8"); wcout.imbue(utf8loc); wcin.imbue(utf8loc); double discriminant = B * B - 4. * A * C; discriminant = sqrt(discriminant); double root1 = (-B + discriminant) / (2. * A); double root2 = (-B - discriminant) / (2. * A); wcout << L"root #1: " << root1 << endl; wcout << L"root #2: " << root2 << endl; return 0; }