ASCII码怎样转为十进制数
1)ASCII码转十进制即按二进制转十进制方法,按权展开求和。[1]例:0110110b
转十进制=0*2^6+1*2^5+1*2^4+0*2^3+1*2^2+1*2^1+0*2^0=54
2)十进制整数转二进制数:“除以2取余,逆序排列”(除二取余法)[1]
ASCII(American Standard Code for Information Interchange,美国标准信息交换代码)是基于拉丁字母的一套电脑编码系统。[2]
参考:
[1]http://baike.baidu.com/link?url=5sKVI3mxz5cafbS1j2U-t-R_zp--7lcVBw8TlmEHqoxJdOPMkuLIABgAz48ZbqybIFLwtWnHVkZGKUpIurUpza
[2]http://baike.baidu.com/link?url=bcWcMdvPdej9fVlBaNrRAeQsQDcf9oxqkvE2hwg7JXtYZaZx8fD0sWPN1V2kRNScUsSAm-oxaZyatIcStloPxUS-FwEAVcSCwIJLFcW5bTbJ6uFkWgxxJslyKGE9qRFYg2Ymv15yji-4j8YBy0Dul_
绛旓細1銆佽嫳鏂囧瓧姣嶆槸瀛楃鍨嬶紝ASCII鐮佸崄杩涘埗鐨勶紝鍥犳鍙渶瑕佸皢瀛楃鍨嬭浆鎹负鍗佽繘鍒讹紝鍦ㄨ緭鍑哄嚱鏁扮殑鏃跺欏己鍒惰浆鎹㈢被鍨銆2銆佷粠宸﹀埌鍙虫瘡涓浣嶇殑鏉冨间负16鐨刵娆℃柟锛宯涓轰粠宸﹀埌鍙崇殑浣嶆暟鍙凤紝浠0寮濮嬨傝浆鎹负鍗佽繘鍒跺嵆鎶鎵鏈夌殑鍊煎搴旂殑鍊间笌16鐨刵娆℃柟鐩镐箻鍚庡啀鐩稿姞鍗冲彲銆3銆佸鏋滆鏄瓧绗︹2鈥欙紝鐩存帴2-0灏卞彲浠ュ緱鍒板崄杩涘埗...
绛旓細1)ASCII鐮佽浆鍗佽繘鍒跺嵆鎸変簩杩涘埗杞崄杩涘埗鏂规硶锛屾寜鏉冨睍寮姹傚拰銆俒1]渚嬶細0110110b杞崄杩涘埗=0*2^6+1*2^5+1*2^4+0*2^3+1*2^2+1*2^1+0*2^0=542)鍗佽繘鍒舵暣鏁拌浆浜岃繘鍒舵暟锛氣滈櫎浠2鍙栦綑锛岄嗗簭鎺掑垪鈥濓紙闄や簩鍙栦綑娉曪級[1]ASCII锛圓mericanStandardCodeforInformationInterchange锛岀編鍥芥爣鍑嗕俊鎭氦鎹唬鐮...
绛旓細1銆佽嫳鏂囧瓧姣嶆槸瀛楃鍨嬶紝ASCII鐮佸崄杩涘埗鐨勶紝鍥犳鍙渶瑕佸皢瀛楃鍨嬭浆鎹负鍗佽繘鍒讹紝鍦ㄨ緭鍑哄嚱鏁扮殑鏃跺欏己鍒惰浆鎹㈢被鍨銆2銆丄SCII鏄互鍗佸叚杩涜浆琛ㄧず鐨勶紝鎵浠ュ氨鏄崄杩涘埗杞崄鍏繘杞紱姣斿1610鐨勫崄杩涜浆瑕佽浆鎹负鍗佸叚杩涜浆锛涜繃绋嬪涓嬶細1610/16=10010(A)锛100/16=64锛6/16=06锛涙墍浠ワ紝1610(10杩涘埗)=64A(16杩涘埗)銆3銆...
绛旓細'D'鐨凙SCII鐮鏄68锛屽垯'd'鐨凙SCII鐮佹槸68+32=100 'j'鐨凙SCII鐮佹槸100+6=106 鍗佽繘鍒惰浆鍖栦负浜岃繘鍒 106(D)=01101010(B)锛岄夋嫨绗竴涓
绛旓細鏈塇EX鎸囦护锛屾槸灏咥SCII鐮佽浆鎴16杩涘埗锛屾病鏈夎浆鎴愬崄杩涘埗鐨銆傚鏋滃崟鏄0鍒9鐨勬暟鎹紝16杩涘埗鍜10杩涘埗鏄竴鏍风殑鍛銆傝繖涓敤姊舰鍥炬惌璧锋潵寰堢儲鐨勫鏋滅敤淇℃嵎鐨勫氨濂戒簡鐩存帴涓涓狢鍑芥暟灏監K浜嗐-9涓暟瀛楃殑ASCII瀵瑰簲鐨勫崄鍏繘鍒舵槸30-39锛屽搴旂殑鍗佽繘鍒舵槸48-57锛屽洜姝ゅ彧瑕佸皢瀵勫瓨鍣ㄤ腑鐨勬暟鍊煎噺鍘48灏辨槸ASCII鐮佸搴旂殑鏁板间簡...
绛旓細鍗佽繘鍒舵暟杞崲涓鍗佸叚杩涘埗鏁伴噰鐢紓闄16鍙栦綑锛岄嗗簭鎺掑垪锛傛硶銆傚叿浣撳仛娉曟槸锛氱敤16鍘婚櫎鍗佽繘鍒舵暣鏁帮紝鍙互寰楀埌涓涓晢鍜屼綑鏁帮紱濡傛杩涜锛岀洿鍒板晢涓洪浂鏃朵负姝紝鐒跺悗鎶婂厛寰楀埌鐨勪綑鏁颁綔涓哄崄鍏繘鍒舵暟鐨勪綆浣嶆湁鏁堜綅锛屽悗寰楀埌鐨勪綑鏁颁綔涓哄崄鍏繘鍒舵暟鐨勯珮浣嶆湁鏁堜綅锛屼緷娆℃帓鍒楄捣鏉ャ傚洜姝わ紝A瀵瑰簲鍗佽繘鍒ASCII鐮鍊兼槸65锛4锛16锛1锛16...
绛旓細浠诲姟浠g爜涓猴細include<stdio.h> main(){char w;printf("璇疯緭鍏ヤ竴涓瓧姣:");scanf("%c",&w);printf("涓庤繖涓瓧姣嶅搴旂殑ASCII鐮佹槸锛%d\n",w);} 鑻辨枃瀛楁瘝鏄瓧绗﹀瀷锛孉SCII鐮佸崄杩涘埗鐨勶紝鍥犳鍙渶瑕佸皢瀛楃鍨嬭浆鎹负鍗佽繘鍒讹紝鍦ㄨ緭鍑哄嚱鏁扮殑鏃跺欏己鍒惰浆鎹㈢被鍨銆
绛旓細SHR锛堢畻鏁板彸绉伙級锛歴hift logical right SAL锛堥昏緫宸︾Щ锛夛細shift arithmetic left SAR锛堥昏緫鍙崇Щ锛夛細shift arithmetic right ROL锛堝惊鐜乏绉伙級锛歳otate left ROR锛堝惊鐜彸绉伙級锛歳otate right RCL锛堝甫杩涗綅鐨勫惊鐜乏绉伙級锛歳otate left through carry RCR锛堝甫杩涗綅鐨勫惊鐜彸绉伙級锛歳otate right through carry ...
绛旓細鍙互鍏堝皢42H锛16杩涘埗锛杞负鍗佽繘鍒锛屼篃灏辨槸66.鍐嶇敤66+23=98.锛堝湪ASCII鐮涓悓涓涓瓧姣嶇殑澶у皬鍐欑浉宸32锛屽張鍥犱负鍏朵腑A涓65锛宎涓97锛屾晠灏忓啓瀛楁瘝鍋忓ぇ鎵浠ユ槸鍔犳硶锛夊啀灏嗗崄杩涘埗98杞寲涓16杩涘埗锛屼篃灏辨槸62H銆傦紙鍙互鍏堝皢鍗佽繘鍒98杞负浜岃繘鍒讹紝鍗1100010锛屽啀灏嗕簩杩涘埗杞负16杩涘埗锛屽叿浣撲负鍥涗綅涓缁勶紝涓嶅鍥涗綅...
绛旓細1)ASCII鐮佽浆鍗佽繘鍒鍗虫寜浜杩涘埗杞崄杩涘埗鏂规硶锛屾寜鏉冨睍寮姹傚拰銆俒1]渚嬶細0110110b 杞崄杩涘埗=0*2^6+1*2^5+1*2^4+0*2^3+1*2^2+1*2^1+0*2^0=54 2)鍗佽繘鍒舵暣鏁拌浆浜杩涘埗鏁锛氣滈櫎浠2鍙栦綑锛岄嗗簭鎺掑垪鈥濓紙闄や簩鍙栦綑娉曪級[1]ASCII锛圓merican Standard Code for Information Interchange锛岀編鍥芥爣鍑...