K
K
Kirill Karpik2019-06-05 22:34:41
Command line
Kirill Karpik, 2019-06-05 22:34:41

Why doesn't the Russian c++ console work?

Hello. There was a question with the Cyrillic output to the console. Tried this code:

#include <iostream>
#include <clocale>
#include <windows.h>

int main() {
  setlocale(LC_ALL,"Rus");
  SetConsoleCP(1251);
  SetConsoleOutputCP(1251);
  cout << "Привет";

  return 0;
}

I tried to use setlocale separately, and separately SetConsoleCP / SetConsoleOutputCP, and together, and changed "Rus" to NULL, and set Lucida Console in the console parameters - nothing helps. Any ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Trionik, 2019-06-06
@Trionik

This is how I do the Russian language in the console:

int main()
{
  setlocale(LC_ALL, "Russian");
}

G
Grigoryan0, 2019-06-08
@Grigoryan0

Another option used. After that, you need to clear the console:

system("chcp 1251");
system("cls");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question