+ 1
How to print ascii table in cpp by using loop
15 Réponses
+ 6
the ascii range is 0 to 127, not 0 to 255... range 128 to 255 are extended ascii table and depends almost on page code used on the system/console running the script (basically, on language used: french have some accents for example).
anyway, range from 0 to 31 (included) and char 127 are non printable character, but character control: that's why you don't see any char printed for those... and char 10 has the meaning of new line (break line, ie: endl in c++) that's why there's a blank line just after it.
char 32 is the first printable char, but quite not visible as is the space character...
from 33 to 126 you can see the char printed at end of line...
from 128 to 255 you can only see a representation of a char meaning that console doesn't know what to put...
+ 1
Thanks 🙏
+ 1
unicode (utf-8/16/32) char in range 0-127 are same as ascii... for compatibility purpose ;)
+ 1
Martin Taylor sure, I have too (we may be quite of same generation)...
but if you remember there was tons of flavour (codepages) related to each languages... that's why unicode was invented: to avoid dealing with more to more languages ^^
by the way, that's why my first post/answer in this thread was talking about of real range of strictly ASCII, without diving in a lot of details about what was extended ascii, its downside, actual common use of unicode and different encoding of it ;P
+ 1
I rather think that output of code playground us utf-8 because hosted on linux systems ;)
web output is only an exception of web based python output when saving image file (to be able to show images of data science courses)...
anyway, you confirm my guess: microisoft windows doesn't still yet support unicode in terminal ;P
+ 1
both javascript and python use utf-16 internally to store strings... I guess (at least some) other languages do it also...
+ 1
and utf-8 is weird as well when coming to count length of string (byte length not always == char length)
0
Is this code is right
0
This code looks fine.
0
But this is not working
0
The ASCII value of each character appears right in this code, or what kind of output do you expect?
0
To print character of that ASCII number
0
Making a table
0
ascii table:
http://www.asciitable.com/mobile/
0
however ascii doesn't range above 127 ^^