Answer the question
In order to leave comments, you need to log in
How to work with Russian characters in C++?
I am programming in Ubuntu and I ran into a problem: Russian characters are not displayed in the terminal.
Looked at the ASCII table and tried to deduce the character codes. Gives the wrong range and wrong characters.
How to solve this problem ?
#include <iostream>
#include <clocale>
using std::cout;
using std::endl;
int main(){
setlocale(LC_CTYPE,"rus");
unsigned char a = 'а';
for(int i = 0; i < 34; i++){
cout<<a<<" "<<static_cast<unsigned int>(a+i)<<endl;
}
return 0;
}
Answer the question
In order to leave comments, you need to log in
#include<iostream>
int main()
{
std::cout << "пиши как есть" << std::endl;
}
$ locale
#include <iostream>
#include <clocale>
using namespace std;
int main()
{
setlocale(LC_ALL,"Russian");
cout << "Привет, Мир!";
return 0;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question