The Unicode code (for example, 20319) of a Chinese character can be obtained by using the following methods:
1, declaring a 3-byte long array of characters, such as Char a[3];
2, assign a value to the array char a[3]={unsigned ( -20319)/256,unsigned (-20319)%256,0};
3, the output can be directly cout<<a<<endl;;
4, you can also assign a character array directly to string strings, such as String Str (a);.
The following is an explanation of step 2, with a Unicode code of 16 bits (unsigned short) and a character char type of only 8 digits, and the function of step 2 is to store the first 8 bits of Unicode and the latter 8 bits in a different 2 byte of a character array, which can be imagined, This should also be true for char-type strings that store Chinese characters. The end of 0 indicates the end of the array.
It is simpler to check the Unicode code of a Chinese character, declare a wchar_t variable, and directly assign a Chinese character, such as wchar_t ch= ' ah ', and direct cout<<ch<<endl; when displayed. However, a warning may be given at compile time. The output file is the same as normal operation.