算法找错
[code#include<stdio.h>#include<string.h>//将16进制的数转化为10进制
#include<math.h>
#define MAX 1000
int main()
{
int count(char s[]);
int i=0,c;
char t[MAX];
printf("input number:");
while ((c=getchar())!='\0'&&i<MAX)
{if(c>='0'&&c<='9'||c>='A'&&c<='F')
t[i++]=c;
}
t[i]='\0';
printf("number: %d",count (t));
return 0;
}
int count (char s[])
{
int i,b=0;
for(i=strlen(s);i>=0;i--)
{if(s[i]>='0'&&s[i]<='9')
b=b+(s[i]-'0')* pow( 16, i);
if(s[i]>='A'&&s[i]<='F')
b=b+(s[i]-'A'+10)* pow( 16, i);}
return (b);
}
][/code]