#include "Stdio.h"
#include "Conio.h"
int strint(const char *str);
main()
{
int n;
char p[]="-123";
n=strint(p);
printf("%d",n);
getch();
}
int strint(const char *str)
{
int temp=0;
const char *ptr=str;
if (*str=='-'||*str=='+')
str++;
while(*str!=0)
{
if((*str<'0')||(*str>'9'))
break;
temp=temp*10+(*str-'0');
str++;
}
if(*ptr=='-')
temp=-temp;
return temp;
}
10万+



被折叠的 条评论
为什么被折叠?



