#include <stdio.h>
long cton(void)
{ char c;
long s=0;
c=getchar();
while(c>='0'&&c<='9')
{s=s*10+c-'0';c=getchar();}//这里少了一句c=getchar();
return (s);
}
void main()
{ printf("input a line of numeric character:");
printf("%ld\n",cton());
getch();
}
s=s*10+c-'0' 尤其是这步