poj 06

 1 #include <stdio.h>
 2 int main()
 3 {
 4  int i=0,a[10]={0},s=0;
 5  char *p,*q;
 6  char str[100]={0};
 7  gets(str);
 8  p=&str[0];
 9    for(;*p!='\0';p++)
10    {
11      if(*p>='0'&&*p<='9')
12      {
13         for(q=p;*q>='0'&&*q<='9';q++)
14         {
15           s=s*10+(*q-48);
16         }
17         p=q;
18         a[i]=s; i++; s=0;
19      }
20    }
21  printf("%d ",i);
22  printf("\n");
23  for(i=0;a[i]!=0;i++)
24      printf("%d ",a[i]);
25  printf("\n");
26 }
posted @ 2012-07-31 23:18  blue——  阅读(178)  评论(0编辑  收藏  举报