+ 4
Why my code is not working properly?
My code is if someone enter a string my code will return the reverse ASCII value of every character . for example if someone give a char which ASCII value is 1.It will return the char which ASCII value is 254. My code works on codeblocks but in sololearn its not working properly.I will be very grateful if someone help me .Thank you very much. Here's my code : https://code.sololearn.com/ceX9LXdkQ3Q7/?ref=app
5 odpowiedzi
+ 3
Technically, true ASCII characters are only 7 bits, values 0 - 127. The first 32 (0 - 31) are non-printable control characters, and 127 is DEL.
The 8-bit values 128 through 255 are adaptable for non-standardized Extended ASCII characters, and often used to add block graphics characters and international characters. Extended ASCII character sets are not universal. However they appear on your screen depends on how your console is configured.
So your program works fine on SoloLearn. It just has a different extended character set than Codeblocks has.
By the way, you can achieve the same inversion of values by using a bitwise not, and thereby eliminate the temp variable. Try this:
string[i] = ~string[i];
+ 3
AteFish🇧🇩 ,ASCII (which stands for American Standard Code for Information Interchange) is a character encoding standard for text files in computers and other devices. Every char has it own ASCII value in decimal
There are 255 ASCII value of a char .My code will reverse the ASCII value.It means my code will work with this logic, 255-string[i]
which will reverse the value of every char.
More information on:
https://www.techonthenet.com/ascii/chart.php
+ 3
https://code.sololearn.com/cC0Fe2WIX10c/?ref=app
encoding problem ? i'm not sure
+ 1
Thank you everyone for your help and contribution.
0
You must have written the wrong codes or you have not put the starting and ending see