Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя Md_Rakib_Hassan_

Автор Md_Rakib_Hassan_, история, 21 месяц назад, По-английски

Is there any possible way to get a character Unicode value by CPP? I was trying it but I can't find any good article on it.
In Python, we can get it by using the ord() function. So is CPP have the same kind of function for getting a character Unicode value?

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

»
21 месяц назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

What would you want to use it for? Do you actually need unicode characters and their values, or are basic ascii characters and their values enough for what you are trying to do?

»
21 месяц назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Just cast the character to int:

cout << (int)L'Ω';

It should output 937.