I
I
Ilya2014-12-14 01:48:04
C++ / C#
Ilya, 2014-12-14 01:48:04

How to work with Cyrillic in c++?

Good day.
Prompt how correctly to make character-by-character display of a line.
Here's what's available:

#include <iostream>
#include <string>
using namespace std;
int main()
{
    string word;
    cin>>word;
    cout<<word<<" - отображение слова целиком\n";
    for (int i=0; i<word.size(); ++i)
        cout<<word[i]<<' ';
    cout<<" - отображение слова посимвольно\n";
    return 0;
}

What I get as output by entering the word "Unicode" (without quotes):

Unicode - Display whole word
\320 \256 \320 \275 \320 \270 \320 \272 \320 \276 \320 \264 - Display word character by character
Program ended with exit code: 0

If it matters, I'm using Xcode 6.1.1 on OS X Yosemite.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MacDag, 2014-12-14
@shatov

setlocale(LC_ALL, "Russian");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question