jeudi 17 octobre 2019

How to print UTF-8 symbols by entering decimal number?

For example I will enter decimal number 210 that is symbol "Ò" and it should be printed on the screen.

For example code:

int a = 210;
wcout << wchar_t (a);

works fine, but before "wcout" I use "cout" and they are not compatible.

Help!

int main() {
  string a = "\u";
  string b = "210";
  string c = a + b;
  cout << b + a << endl;
  cout << "Second cout message...";
}

ERROR:

main.cpp:4:15: error: \u used with no
      following hex digits
  string a = "\u";
              ^~
1 error generated.
compiler exit status 1

Aucun commentaire:

Enregistrer un commentaire