intmy_dec(constchar* str)//十进制 {int sum =0;while(*str !='\0'){if(*str >='0'&&*str <='9'){
sum = sum *10+*str -'0';}
str++;}return sum;}- 或者
intmy_dec(constchar* str)//十进制{int sum =0;while(isdigit(*str)){
sum = sum *10+*str -'0';
str++;}return sum;}
八进制
intmy_oct(constchar* str)//八进制{int sum =0;while(isdigit(*str)&&*str !='8'&&*str !='9'){
sum = sum *8+*str -'0';//任何进制转换为十进制就是乘以它的幂次方
str++;}return sum;}
十六进制
intmy_hex(constchar* str)//十六进制{int sum =0;while(isxdigit(*str)){if(isdigit(*str)){
sum = sum *16+*str -'0';}else{char ch =tolower(*str);
sum = sum *16+ ch -'a'+10;//16进制字母的转换}
str++;}return sum;}