How to print Unicode character in C++?

C++Server Side ProgrammingProgramming

To print the Unicode characters, the process is very similar to the actual printing process in C++.

We can put the Unicode value with the prefix \u. Thus we can successfully print the Unicode character.

Note: If the console does not support Unicode, then you cannot get the correct result. Here we have used the Linux system to solve this problem.

Example

#include <iostream>
using namespace std;
int main() {
   cout << "Character: \u092E\n";
   cout << "Character: \u0938\n";
   cout << "Character: \u0915\n";
}

Output

Character: म
Character: म
Character: म
raja
Published on 02-May-2019 12:39:31
Advertisements