online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <locale> #include <clocale> #include <cwchar> #include <cmath> class index { char narrow_str[20] = {}; wchar_t warr[10]; public: index(const char * znakUTF8) { for (int i = 0; i < 18 && i < sizeof(znakUTF8); i++) narrow_str[i] = znakUTF8[i]; std::setlocale(LC_ALL, "en_US.UTF-8"); std::swprintf(warr, sizeof warr / sizeof * warr, L"%s", narrow_str); std::wcout.imbue(std::locale("C.UTF-8")); } wchar_t * get() { return warr; } }; int main() { index ix("\u00B2"); std::wcout << L"Podaj fajną liczbę : "; int n = 6817; std::wcin >> n; for (int i = 1, j = sqrt(n); i <= j;) { int sqn = j * j + i * i; if (sqn > n) j--; else if (sqn < n) i++; else { std::wcout << index("\u2603").get() << " " << n << "=" << i << ix.get() << "+" << j << ix.get() << '\n' << std::flush; i++; } } return 0; } //https://en.cppreference.com/w/cpp/locale/setlocale //https://en.cppreference.com/w/cpp/io/c/fwprintf

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue