/****************************************************************************** * This program checks a traingle to see if it is a right triangle. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #include "Utils.hpp" #include #include #include #include std::locale utf8loc(std::locale(), new std::codecvt_utf8); using namespace std; int main(int argc, char **argv) { setlocale(LC_ALL, "en_US.UTF-8"); wcout.imbue(utf8loc); wcin.imbue(utf8loc); wstring const HYPOTENUSE_STR = Utils::prompt(L"Hypotenuse: "); wstring const LEG1_STR = Utils::prompt(L"Leg #1: "); wstring const LEG2_STR = Utils::prompt(L"Leg #2: "); double const HYPOTENUSE = Utils::stodWithDefault(HYPOTENUSE_STR, 0.); double const LEG1 = Utils::stodWithDefault(LEG1_STR, 0.); double const LEG2 = Utils::stodWithDefault(LEG2_STR, 0.); bool const IS_RIGHT_TRIANGLE = HYPOTENUSE * HYPOTENUSE == LEG1 * LEG1 + LEG2 * LEG2; wcout << L"Triangle is " << (IS_RIGHT_TRIANGLE ? L"" : L"NOT ") << L"a right triangle!" << endl; return 0; }