我的程序,请高手指正:
#include "Stdio.h"
#include "Conio.h"
#include "string.h"
int multiple(int n);
main()
{
char c[20];
int i,N,dec;
printf("please enter a hex number:\n");
scanf("%s",c);
N=strlen(c);
printf("%d\n",N);
dec=0;
for(i=N-1;i>=0;i--)
dec+=c[i]*multiple(N-i);
printf("after change,the dec number is:%d\n",dec);
getch();
}
int multiple(int n)
{ int i,t;
t=1;
for(i=1;i<n;i++)
t=16*t;
return t;
}