#include<stdio.h>
int main(int argc, char ** argv)
{
char szBuf[1024] = { 0 };
char *p;
int a[256], _cnt = 0, _tmp = 0, _flag = 0;
fgets(szBuf,1000,stdin);
p = szBuf;
while (*p)
{
if (*p >= 0x30 && *p <= 0x39)
{
_tmp *= 10;
_tmp += (*p) - 0x30;
_flag = 1;
}
else if (_flag)
{
a[_cnt++] = _tmp;
_tmp = 0;
_flag = 0;
}
p++;
}
printf("total:%d\n", _cnt);
while (_cnt--) printf("%d ", a[_cnt]);
return 0;
}
追问连续的数字作为一个整数
本回答被网友采纳