Match binary coding with character or numerical value?
It's asking me to match the binary coding with the numerical number 5, but also ASCII character 5? What is the difference and how can I find the answer? It also asked me the code in the binary system for "P" and I got the answer, 01010000. Is that correct? I want to be sure I'm doing the assignment correctly before I submit it. Thanks!
回答 (3)
ASCII assigns each number from 0 to 255 a character.
The capital letters start at ASCII code 65, in 8 bit binary that's 0100 0001 (the letter A)
The numbers from 0 to 9 are ASCII 48 to 57.
dec | _ binary _ | _ character
48 = 0011 0000 => 0
49 = 0011 0001 => 1
...
53 = 0011 0101 => 5
...
57 = 0011 1001 => 9
...
65 = 010 00001 => A
66 = 010 00010 => B
...
80 = 010 10000 => P
...
90 = 010 11010 => Z
...
97 = 011 00001 => a
98 = 011 00010 => b
...
112= 011 10000 => p
...
122= 011 11010 => z
...
binary 5 is 101
to get the character '5' just add the value to'0'
character5='0'+5;
ASCII made their own system of number=>character
They could decide on anything. They could have decided:
0=>7
1=>B
2=>9
3=>t
So the binary coding for 5 is just the binary coding, nothing special there. But the ASCII character is the binary coding for whatever number they decided maps to the character 5.
You have P correct. I wasn't going to look anything up to answer this, but decided to just to make sure you understood what was going on.
收錄日期: 2021-04-21 23:34:36
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20160928100408AA0MmrF
檢視 Wayback Machine 備份