The problem is that I want to display the symbol £ I recognized his code char c = '£'; cout<<(int)c; but when I try to display this character £ char ch = 63; cout<<ch; £ char ch = 63; cout<<ch; displays another character

  • If mnemonics do, then: & pound; or & # 163; - Deonis

2 answers 2

Most likely your program and OS use different encodings. The system default ANSI encoding covers the entire ASCII character set, but uses a different encoding mechanism. The use of the default encoding is not recommended, since different default codepage can be used on different systems. See MSDN . You need to explicitly set the encoding in your program. See setlocale () :

 setlocale(LC_ALL, "en-US.UTF-8"); 

UTF-8 pound code:

 0xA3 

    @ Roman1 , apparently you have Windows and the cp1251 encoding (in the standard cmd window, the cp866 encoding and there you would see the Russian letter 'g').

    Yes, there the code 163 (he is 0xa3) corresponds to an image not of a pound, but of something similar to J

    -

    By the way, in the text of the question you output the code 63, and this is the character '?'.

    And please, next time in more detail describe the environment in which you program (at least specify the OS).