求16进制转化10进制的算法,求改错
main(){
int ch[80];
int change(char a[]);
printf("please input any numbers:\n");
gets(ch);
change(ch);
printf("%d\n",change(ch));
}
int change(char s1[])
{
int i,n,m;
m=0;
for(i=0;s1[i]!='\0';i++)
{
if(s1[i]>='0'&&s1[i]<='9')
{ n=s1[i]-'0';
m=n*pow(16,(i-1))+m;
}
if(s1[i]>='a'&&s1[i]<='f')
{ n=s1[i]-'a'+10;
m=n*pow(16,(i-1))+m;
}
if(s1[i]>='A'&&s1[i]<='F')
{ n=s1[i]-'A'+10;
m=n*pow(16,(i-1))+m;
}
return(m);
}
}
求改错