/****************************************************************************** * This program demonstrates string comparisons. * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #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 COLOR1 = L"Blue"; wstring const COLOR2 = L"Red"; bool result; wcout << L"compare(color1, color2): " << COLOR1.compare(COLOR2) << endl; result = COLOR1 < COLOR2; wcout << L"color1 < color2: " << result << endl; result = COLOR1 > COLOR2; wcout << L"color1 > color2: " << result << endl; result = COLOR1 == COLOR2; wcout << L"color1 == color2: " << result << endl; result = COLOR1 != COLOR2; wcout << L"color1 != color2: " << result << endl; return 0; }