B
B
bushmaks2017-10-18 01:08:35
ASCII
bushmaks, 2017-10-18 01:08:35

How to display ASCII characters in XCode in C++?

There was a need to display characters from the ASCII table in the console, but when using

(char)Some number

cout << (char)218 << setw(8) << (char)196 << setw(8) << (char)194 << setw(8) << (char)196 << setw(8) << (char)194 << setw(8) << (char)196 << setw(8) << (char)191 << endl;
    cout << setw(9) << "X" << setw(16) << "F" << setw(16) << "G" << endl;

displays
\ some other number

59e36749db87f165905643.png
I guess that the problem is in the encoding, but I still don’t understand how to make these characters appear in the console. I would be glad for any help
. UPD:
The standard for ASCII is exactly the 128 first characters. The rest of the ASCII characters are optional. From wikipedia :
ASCII includes definitions for 128 characters: 33 are
non-printing, mostly obsolete control characters that affect
how text is processed;[6] 94 are printable characters, and the
space is considered an invisible graphic.

As a result, I used characters from Unicode in the Box Drawing section, if someone needs it, then we just use Source Code , you can take it from this site: Graphemica.comcout << "Source Code";

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Semchenko, 2017-10-18
@bushmaks

There are 128 characters in ASCII.

R
res2001, 2017-10-18
@res2001

Some other number is the same number in octal.
To display characters instead of numbers, try this:
cout << (unsigned char)218;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question