Home visual-studio Russian text in

Russian text in [Duplicate]

Author

Date

Category

I have to write Russian words English letters in console applications. Russian program itself (I have Visual Studio 2010 Express). Tell me what you need to make it possible to bring Russian letters?
Thanks in advance.

found an answer (if anyone needs)

# include & lt; locale.h & gt;
INT MAIN ()
{
SETLOCALE (LC_ALL, "RUS");

Answer 1, Authority 100%

Method 1: Use WCOUT :

# include & lt; iostream & gt;
Using Namespace STD;
Void Main ()
{
  wcout.imbue (Locale (. 866 "));
  WCOUT & LT; & LT; L "Hi, world!";
}

as an option, you can connect & lt; Windows.h & gt; and use setConsoleoutPutcp (1251)
But for some reason I did not earn this way in 7ke, I was to understand the injury. But it should have been necessary for him in the project settings some tick switch, in general, use WCout , it is better, and works not only in Windows.


method 2:
I remembered another way, perhaps the easiest:

setlocale (lc_all, "russian");
COUT & LT; & LT; "Hello World!" & lt; & lt; Endl;

Answer 2, Authority 67%

Do not install anything. Only Latin is allowed in the identifiers. And in Unicode Lines you can write any characters, including Chinese characters.

Example.

# include & lt; stdio.h & gt;
INT MAIN ()
{
  wprintf (_t ("hello, world \ n"));
  Return 0;
}

What is written in lines: “Hello, peace”, etc., should be placed inside the macro _t () for unicode rows, and everything else must be a latin (with the exception of comments).


Answer 3

Try this option.

& lt; windows.h & gt;
Ostream & amp; Operator & lt; & lt; (Ostream & amp; Out, char * s)
 {
   Char BUF [512], * p = buf;
   ChartooEEm (S, BUF);
   While (* P)
     OUT & LT; & LT; * P ++;
     RETURN OUT;
 }

Answer 4

Compiling cantilever applications on the glorious C++ programming language are constantly encountered with the problem of encoding. Russian letters are derived as doodles, and with English everything is in order. Case in encodings. In Windows Console, use OEM encoding. And in the Windows itself – ANSI encoding.

To avoid problems with the conclusion of Russian letters in the console, we will use the ChartooEEm function.

The ChartooEEEEEEEm feature converts a string into a set of symbols of OEM. This feature is the opposite of the featureem function.
I think the question is closed 🙂


Answer 5

How the option can be used _CWPRINTF, but it is only in Visual C++.


Answer 6

I do not know whether it will work, but you can try, for example, if there is an option in the massif in English in the ASCII table to find and replace the Russian, well, for example, (this is just an example) English letter A has a figure 20, and Russian 60. You make a function that, if you give an array, it will replace 20 digit to 60, and the program will show Russian A, but this with the CIN operator does not turn, I probably do not know.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions