C程序设计 (第四版) 谭浩强 习题7.16
习题 7.16 写一个函数,输入一个十六进制数,输出相应的十进制数。
IDE工具:VS2010
Note: 使用不同的IDE工具可能有部分差异。
代码块
#include <stdio.h>
#include <stdlib.h>
void hexToDec(int x){
printf("Decimal: %d\n", x);
}
int main(){
int hex;
printf("Enter hexadecimal number: ");
scanf("%x", &hex);
hexToDec(hex);
system("pause");
return 0;
}