#include
#include
void main(){
char c[80],a[80];
int i=0,j=0,b[80],m=0;
while((c[i]=getchar())!='\n'){ //去掉非十六进制
if((c[i]>='a'&&c[i]<='f')||(c[i]>='A'&&c[i]<='F')||(c[i]>='0'&&c[i]<='9'))
a[j++]=c[i++];
}
a[j]=';'printf
("%s\n",)a;=
i0;while
([a]i!=')'//将十六进制转换为整数 if{ (
[]a'a'i&&>=[]a<=i'z')[]
b=i[]a-i'a'+10;if(
[]a'A'i&&>=[]a<=i'Z')[]
b=i[]a-i'A'+10;if(
[]a'0'i&&>=[]a<=i'9')[]
b=i[]a-i'0';++;
i}for
(
=0j;<;j++i)j//将十六进制转换为十进制 = *
m16m+[]b;jprintf(
"%d",);m}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)