Other languages

Hi!

Currently I am trying to output “Привет мир” (which is “Hello world”) but I get ??? and some weird blocks, i have tried many solutions, but it doesnt help, can anyone please help me so that I could output russian text properly?

Thank you!

#include <iostream>

int main()
{
    std::cout <<"Привет мир";
}

Sorry I missed this. Assuming you’re on Windows it’ll probably be easier to use Unicode and wide strings.

#include <iostream>

#include <io.h>
#include <fcntl.h>

int main()
{
    _setmode(_fileno(stdout), _O_U16TEXT);
    std::wcout << L"Привет мир";
}

std::wcout is for wide character output
L"thing" is for a wide string literal.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms