nt htio(char a[]){int i = 0;int n = 1;int sum = 0;while (a[i] != '\0'){i++;}i--;while (a[i] != 'X' && a[i] != 'x' &&i>=0){ if(a[i] >= '0' && a[i] <='9'){sum = sum + (a[i]-'0')*n;i--;n = n*16;}else if(a[i] >= 'a' && a[i] <= 'f'){sum = sum + (a[i] - 'a' + 10)*n;i--;n = n*16;}else if (a[i] >= 'A' && a[i] <= 'F'){sum = sum + (a[i] - 'A' + 10)*n;i--;n = n*16;}}return sum;}
- 1 回答
- 0 关注
- 100 浏览
添加回答
举报
0/150
提交
取消