// 将字符串转换为数字
int str2int(char *s) { if (s==NULL) return 0; int temp=0; int vl=0; bool flag=false; while(*s!='\0') { if (*s=='-') { flag=1; s++; } temp = *s-'0'; vl = vl*10+temp; s++; } return flag==true ? -vl:vl; }