<div ><span style="font-family:宋體"> </span><span style="color:rgb(216, 216, 216);font-family:宋體">ASCII是程序員和使用計算機的人類必須知道的基本常識。</span><div><span style="font-family:宋體"> 當你在電腦上打字,閱讀,聊天發信息的時候,你有沒有想過這些字是如何保存在電腦里,如何發送出去的?很顯然電腦不會傻傻的“一筆一劃”地寫入磁盤或是這樣發送,而是以一種叫做ASCII編碼(美國標準信息交換碼)的方式存放在磁盤里。也就是說,每一個字,每一個字符,都有與其對應的ASCII編碼,這就像是給每一個字符都編了個號。</span><br/></div><div><span style="font-family:宋體"><br/></span></div><div><span style="font-family:宋體"> 以下是ASCII英文碼表:<br/></span></div><div><span style="font-family:宋體"> (十進制) 編號 八進制 十六進制 二進制 字符<br/></span></div><div><span style="font-family:宋體"><span style="color:rgb(0, 0, 0);font-family:'[object HTMLOptionElement]', 'Lucida Console', 'Courier New', Verdana;font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:2;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:2;word-spacing:0px;-webkit-text-decorations-in-effect:none;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px"><span style="color:rgb(0, 0, 0)"> Decimal Octal Hex Binary Value</span><br/><span style="color:rgb(0, 0, 0)"> ------- ----- --- ------ -----</span><br/><span style="color:rgb(0, 0, 0)"> 000 000 000 00000000 NUL (Null char.)</span><br/><span style="color:rgb(0, 0, 0)"> 001 001 001 00000001 SOH (Start of Header)</span><br/><span style="color:rgb(0, 0, 0)"> 002 002 002 00000010 STX (Start of Text)</span><br/><span style="color:rgb(0, 0, 0)"> 003 003 003 00000011 ETX (End of Text)</span><br/><span style="color:rgb(0, 0, 0)"> 004 004 004 00000100 EOT (End of Transmission)</span><br/><span style="color:rgb(0, 0, 0)"> 005 005 005 00000101 ENQ (Enquiry)</span><br/><span style="color:rgb(0, 0, 0)"> 006 006 006 00000110 ACK (Acknowledgment)</span><br/><span style="color:rgb(0, 0, 0)"> 007 007 007 00000111 BEL (Bell)</span><br/><span style="color:rgb(0, 0, 0)"> 008 010 008 00001000 BS (Backspace)</span><br/><span style="color:rgb(0, 0, 0)"> 009 011 009 00001001 HT (Horizontal Tab)</span><br/><span style="color:rgb(0, 0, 0)"> 010 012 00A 00001010 LF (Line Feed)</span><br/><span style="color:rgb(0, 0, 0)"> 011 013 00B 00001011 VT (Vertical Tab)</span><br/><span style="color:rgb(0, 0, 0)"> 012 014 00C 00001100 FF (Form Feed)</span><br/><span style="color:rgb(0, 0, 0)"> 013 015 00D 00001101 CR (Carriage Return)</span><br/><span style="color:rgb(0, 0, 0)"> 014 016 00E 00001110 SO (Shift Out)</span><br/><span style="color:rgb(0, 0, 0)"> 015 017 00F 00001111 SI (Shift In)</span><br/><span style="color:rgb(0, 0, 0)"> 016 020 010 00010000 DLE (Data Link Escape)</span><br/><span style="color:rgb(0, 0, 0)"> 017 021 011 00010001 DC1 (XON) (Device Control 1)</span><br/><span style="color:rgb(0, 0, 0)"> 018 022 012 00010010 DC2 (Device Control 2)</span><br/><span style="color:rgb(0, 0, 0)"> 019 023 013 00010011 DC3 (XOFF)(Device Control 3)</span><br/><span style="color:rgb(0, 0, 0)"> 020 024 014 00010100 DC4 (Device Control 4)</span><br/><span style="color:rgb(0, 0, 0)"> 021 025 015 00010101 NAK (Negative Acknowledgement)</span><br/><span style="color:rgb(0, 0, 0)"> 022 026 016 00010110 SYN (Synchronous Idle)</span><br/><span style="color:rgb(0, 0, 0)"> 023 027 017 00010111 ETB (End of Trans. Block)</span><br/><span style="color:rgb(0, 0, 0)"> 024 030 018 00011000 CAN (Cancel)</span><br/><span style="color:rgb(0, 0, 0)"> 025 031 019 00011001 EM (End of Medium)</span><br/><span style="color:rgb(0, 0, 0)"> 026 032 01A 00011010 SUB (Substitute)</span><br/><span style="color:rgb(0, 0, 0)"> 027 033 01B 00011011 ESC (Escape)</span><br/><span style="color:rgb(0, 0, 0)"> 028 034 01C 00011100 FS (File Separator)</span><br/><span style="color:rgb(0, 0, 0)"> 029 035 01D 00011101 GS (Group Separator)</span><br/><span style="color:rgb(0, 0, 0)"> 030 036 01E 00011110 RS (Request to Send)(Record Separator)</span><br/><span style="color:rgb(0, 0, 0)"> 031 037 01F 00011111 US (Unit Separator)</span><br/><span style="color:rgb(0, 0, 0)"> 032 040 020 00100000 SP (Space)</span><br/><span style="color:rgb(0, 0, 0)"> 033 041 021 00100001 ! (exclamation mark)</span><br/><span style="color:rgb(0, 0, 0)"> 034 042 022 00100010 " (double quote)</span><br/><span style="color:rgb(0, 0, 0)"> 035 043 023 00100011 # (number sign)</span><br/><span style="color:rgb(0, 0, 0)"> 036 044 024 00100100 $ (dollar sign)</span><br/><span style="color:rgb(0, 0, 0)"> 037 045 025 00100101 % (percent)</span><br/><span style="color:rgb(0, 0, 0)"> 038 046 026 00100110 & (ampersand)</span><br/><span style="color:rgb(0, 0, 0)"> 039 047 027 00100111 ' (single quote)</span><br/><span style="color:rgb(0, 0, 0)"> 040 050 028 00101000 ( (left/opening parenthesis)</span><br/><span style="color:rgb(0, 0, 0)"> 041 051 029 00101001 ) (right/closing parenthesis)</span><br/><span style="color:rgb(0, 0, 0)"> 042 052 02A 00101010 * (asterisk)</span><br/><span style="color:rgb(0, 0, 0)"> 043 053 02B 00101011 + (plus)</span><br/><span style="color:rgb(0, 0, 0)"> 044 054 02C 00101100 , (comma)</span><br/><span style="color:rgb(0, 0, 0)"> 045 055 02D 00101101 - (minus or dash)</span><br/><span style="color:rgb(0, 0, 0)"> 046 056 02E 00101110 . (dot)</span><br/><span style="color:rgb(0, 0, 0)"> 047 057 02F 00101111 / (forward slash)</span><br/><span style="color:rgb(0, 0, 0)"> 048 060 030 00110000 0</span><br/><span style="color:rgb(0, 0, 0)"> 049 061 031 00110001 1</span><br/><span style="color:rgb(0, 0, 0)"> 050 062 032 00110010 2</span><br/><span style="color:rgb(0, 0, 0)"> 051 063 033 00110011 3</span><br/><span style="color:rgb(0, 0, 0)"> 052 064 034 00110100 4</span><br/><span style="color:rgb(0, 0, 0)"> 053 065 035 00110101 5</span><br/><span style="color:rgb(0, 0, 0)"> 054 066 036 00110110 6</span><br/><span style="color:rgb(0, 0, 0)"> 055 067 037 00110111 7</span><br/><span style="color:rgb(0, 0, 0)"> 056 070 038 00111000 8</span><br/><span style="color:rgb(0, 0, 0)"> 057 071 039 00111001 9</span><br/><span style="color:rgb(0, 0, 0)"> 058 072 03A 00111010 : (colon)</span><br/><span style="color:rgb(0, 0, 0)"> 059 073 03B 00111011 ; (semi-colon)</span><br/><span style="color:rgb(0, 0, 0)"> 060 074 03C 00111100 < (less than)</span><br/><span style="color:rgb(0, 0, 0)"> 061 075 03D 00111101 = (equal sign)</span><br/><span style="color:rgb(0, 0, 0)"> 062 076 03E 00111110 > (greater than)</span><br/><span style="color:rgb(0, 0, 0)"> 063 077 03F 00111111 ? (question mark)</span><br/><span style="color:rgb(0, 0, 0)"> 064 100 040 01000000 @ (AT symbol)</span><br/><span style="color:rgb(0, 0, 0)"> 065 101 041 01000001 A</span><br/><span style="color:rgb(0, 0, 0)"> 066 102 042 01000010 B</span><br/><span style="color:rgb(0, 0, 0)"> 067 103 043 01000011 C</span><br/><span style="color:rgb(0, 0, 0)"> 068 104 044 01000100 D</span><br/><span style="color:rgb(0, 0, 0)"> 069 105 045 01000101 E</span><br/><span style="color:rgb(0, 0, 0)"> 070 106 046 01000110 F</span><br/><span style="color:rgb(0, 0, 0)"> 071 107 047 01000111 G</span><br/><span style="color:rgb(0, 0, 0)"> 072 110 048 01001000 H</span><br/><span style="color:rgb(0, 0, 0)"> 073 111 049 01001001 I</span><br/><span style="color:rgb(0, 0, 0)"> 074 112 04A 01001010 J</span><br/><span style="color:rgb(0, 0, 0)"> 075 113 04B 01001011 K</span><br/><span style="color:rgb(0, 0, 0)"> 076 114 04C 01001100 L</span><br/><span style="color:rgb(0, 0, 0)"> 077 115 04D 01001101 M</span><br/><span style="color:rgb(0, 0, 0)"> 078 116 04E 01001110 N</span><br/><span style="color:rgb(0, 0, 0)"> 079 117 04F 01001111 O</span><br/><span style="color:rgb(0, 0, 0)"> 080 120 050 01010000 P</span><br/><span style="color:rgb(0, 0, 0)"> 081 121 051 01010001 Q</span><br/><span style="color:rgb(0, 0, 0)"> 082 122 052 01010010 R</span><br/><span style="color:rgb(0, 0, 0)"> 083 123 053 01010011 S</span><br/><span style="color:rgb(0, 0, 0)"> 084 124 054 01010100 T</span><br/><span style="color:rgb(0, 0, 0)"> 085 125 055 01010101 U</span><br/><span style="color:rgb(0, 0, 0)"> 086 126 056 01010110 V</span><br/><span style="color:rgb(0, 0, 0)"> 087 127 057 01010111 W</span><br/><span style="color:rgb(0, 0, 0)"> 088 130 058 01011000 X</span><br/><span style="color:rgb(0, 0, 0)"> 089 131 059 01011001 Y</span><br/><span style="color:rgb(0, 0, 0)"> 090 132 05A 01011010 Z</span><br/><span style="color:rgb(0, 0, 0)"> 091 133 05B 01011011 [ (left/opening bracket)</span><br/><span style="color:rgb(0, 0, 0)"> 092 134 05C 01011100 \ (back slash)</span><br/><span style="color:rgb(0, 0, 0)"> 093 135 05D 01011101 ] (right/closing bracket)</span><br/><span style="color:rgb(0, 0, 0)"> 094 136 05E 01011110 ^ (caret/circumflex)</span><br/><span style="color:rgb(0, 0, 0)"> 095 137 05F 01011111 _ (underscore)</span><br/><span style="color:rgb(0, 0, 0)"> 096 140 060 01100000 `</span><br/><span style="color:rgb(0, 0, 0)"> 097 141 061 01100001 a</span><br/><span style="color:rgb(0, 0, 0)"> 098 142 062 01100010 b</span><br/><span style="color:rgb(0, 0, 0)"> 099 143 063 01100011 c</span><br/><span style="color:rgb(0, 0, 0)"> 100 144 064 01100100 d</span><br/><span style="color:rgb(0, 0, 0)"> 101 145 065 01100101 e</span><br/><span style="color:rgb(0, 0, 0)"> 102 146 066 01100110 f</span><br/><span style="color:rgb(0, 0, 0)"> 103 147 067 01100111 g</span><br/><span style="color:rgb(0, 0, 0)"> 104 150 068 01101000 h</span><br/><span style="color:rgb(0, 0, 0)"> 105 151 069 01101001 i</span><br/><span style="color:rgb(0, 0, 0)"> 106 152 06A 01101010 j</span><br/><span style="color:rgb(0, 0, 0)"> 107 153 06B 01101011 k</span><br/><span style="color:rgb(0, 0, 0)"> 108 154 06C 01101100 l</span><br/><span style="color:rgb(0, 0, 0)"> 109 155 06D 01101101 m</span><br/><span style="color:rgb(0, 0, 0)"> 110 156 06E 01101110 n</span><br/><span style="color:rgb(0, 0, 0)"> 111 157 06F 01101111 o</span><br/><span style="color:rgb(0, 0, 0)"> 112 160 070 01110000 p</span><br/><span style="color:rgb(0, 0, 0)"> 113 161 071 01110001 q</span><br/><span style="color:rgb(0, 0, 0)"> 114 162 072 01110010 r</span><br/><span style="color:rgb(0, 0, 0)"> 115 163 073 01110011 s</span><br/><span style="color:rgb(0, 0, 0)"> 116 164 074 01110100 t</span><br/><span style="color:rgb(0, 0, 0)"> 117 165 075 01110101 u</span><br/><span style="color:rgb(0, 0, 0)"> 118 166 076 01110110 v</span><br/><span style="color:rgb(0, 0, 0)"> 119 167 077 01110111 w</span><br/><span style="color:rgb(0, 0, 0)"> 120 170 078 01111000 x</span><br/><span style="color:rgb(0, 0, 0)"> 121 171 079 01111001 y</span><br/><span style="color:rgb(0, 0, 0)"> 122 172 07A 01111010 z</span><br/><span style="color:rgb(0, 0, 0)"> 123 173 07B 01111011 { (left/opening brace)</span><br/><span style="color:rgb(0, 0, 0)"> 124 174 07C 01111100 | (vertical bar)</span><br/><span style="color:rgb(0, 0, 0)"> 125 175 07D 01111101 } (right/closing brace)</span><br/><span style="color:rgb(0, 0, 0)"> 126 176 07E 01111110 ~ (tilde)</span><br/><span style="color:rgb(0, 0, 0)"> 127 177 07F 01111111 DEL (delete)</span></span><br/></span></div><div><span style="font-family:宋體"><br/></span></div><div><span style="font-family:宋體"> 于此相同或類似,也有中文的ASCII碼,但是中文表實在是太長我這就不貼碼表了。</span></div><div><span style="font-family:宋體"> 沒錯,你的電腦就是以這樣的方式保存、理解和傳送一個個字符的。對于這個表,雖然我們沒有必要去背,<span style="font-family:宋體;color:rgb(127, 127, 127)">(如果你是程序員,只需要背其中少數幾個就行了)</span>但是我們至少得知道有這么一個東西。<br/></span></div><div><span style="font-family:宋體"> <br/></span></div><div><span style="font-family:宋體"> 不知道大家以前有沒有弄過一個叫做“人品計算器”的程序,就是你輸入一個人的名字,這個程序就會“計算”出其“人品”值,其原理也就是先把漢子轉換為ASCII編碼,然后再做一些運算——換句話說,這些類似的程序都只供大家娛樂娛樂,并沒有實際依據的哦。<br/></span></div><div><span style="font-family:宋體"><br/></span></div><div><span style="font-family:宋體"> 這里給出一個人品計算器的例程……僅供學習C++和ASCII之用……<br/></span></div><div><div><span style="color:rgb(84, 141, 212)">#include</span> <stdio.h></div><div><span style="color:rgb(84, 141, 212)">unsigned int</span> inpu[<span style="color:rgb(147, 137, 83)">10</span>], i;</div><div><span style="color:rgb(84, 141, 212)">unsigned long</span> sum;</div><div><span style="color:rgb(84, 141, 212)">void</span> main (<span style="color:rgb(84, 141, 212)">void</span>) <span style="color:rgb(255, 0, 0)">{</span></div><div> <span style="color:rgb(178, 162, 199)">scanf</span>("%s", inpu);</div><div> sum = <span style="color:rgb(147, 137, 83)">0</span>;</div><div><span style="color:rgb(84, 141, 212)"> for</span> (i=<span style="color:rgb(147, 137, 83)">0</span>; i<<span style="color:rgb(147, 137, 83)">10</span>; i<span style="color:rgb(250, 192, 143)">++</span>) <span style="color:rgb(255, 192, 0)">{</span></div><div> sum <span style="color:rgb(250, 192, 143)">+=</span> inpu[i];</div><div> <span style="color:rgb(255, 192, 0)">}</span></div><div> <span style="color:rgb(178, 162, 199)">printf</span>("RP計算結果 = %d分\n", sum<span style="color:rgb(250, 192, 143)">%</span><span style="color:rgb(147, 137, 83)">100</span>);</div><div><span style="color:rgb(255, 0, 0)">}</span></div></div></div>
</div>
</div>
|