+ 1

How to print ascii table in cpp by using loop

https://code.sololearn.com/cec9e00A7RL4/?ref=app

22nd Mar 2021, 6:46 AM
Harsh Pratap Singh
Harsh Pratap Singh - avatar
15 odpowiedzi
+ 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...
22nd Mar 2021, 10:30 AM
visph
visph - avatar
+ 1
Thanks 🙏
22nd Mar 2021, 10:52 AM
Harsh Pratap Singh
Harsh Pratap Singh - avatar
+ 1
unicode (utf-8/16/32) char in range 0-127 are same as ascii... for compatibility purpose ;)
22nd Mar 2021, 1:09 PM
visph
visph - avatar
+ 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
22nd Mar 2021, 7:52 PM
visph
visph - avatar
+ 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
23rd Mar 2021, 9:48 PM
visph
visph - avatar
+ 1
both javascript and python use utf-16 internally to store strings... I guess (at least some) other languages do it also...
24th Mar 2021, 3:32 PM
visph
visph - avatar
+ 1
and utf-8 is weird as well when coming to count length of string (byte length not always == char length)
24th Mar 2021, 3:34 PM
visph
visph - avatar
0
Is this code is right
22nd Mar 2021, 6:47 AM
Harsh Pratap Singh
Harsh Pratap Singh - avatar
0
This code looks fine.
22nd Mar 2021, 7:04 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
But this is not working
22nd Mar 2021, 7:09 AM
Harsh Pratap Singh
Harsh Pratap Singh - avatar
0
The ASCII value of each character appears right in this code, or what kind of output do you expect?
22nd Mar 2021, 8:01 AM
你知道規則,我也是
你知道規則,我也是 - avatar
0
To print character of that ASCII number
22nd Mar 2021, 9:42 AM
Harsh Pratap Singh
Harsh Pratap Singh - avatar
0
Making a table
22nd Mar 2021, 9:43 AM
Harsh Pratap Singh
Harsh Pratap Singh - avatar
22nd Mar 2021, 10:41 AM
visph
visph - avatar
0
however ascii doesn't range above 127 ^^
22nd Mar 2021, 1:22 PM
visph
visph - avatar