Seeking a continuous string of digits which appears, and shaping a consecutive number which is stored in a shaping array, and then output

code show as below:

1  // continuously seeking a string of digits which appears, and shaping a consecutive number which is stored in a shaping array, and then outputs 
2 # the include <stdio.h>
 . 3  int A [ 20 is ] = { 0 };
 . 4  char C [ 50 ];
 . 5  int main ()
 . 6  {
 . 7      the printf ( " Please enter the string: " );
 . 8      the gets (C);
 . 9      int K = 0 , I, J = - . 1 ;
 10      for (I = 0 ; * (C + I) =! 0 ; I ++ )
 . 11      {
 12 is          IF(* (C + I)> = ' 0 ' && * (C + I) <= ' . 9 ' ) 
 13 is          {
 14              IF (K == 0 ) J ++ ;
 15              A [J] = A [J] * 10 + * (C + I) - 48 ;
 16              K = . 1 ;
 . 17          }
 18 is          the else K = 0 ;
 . 19      }
 20 is      the printf ( " the number of integers which are D%: " , J);
 21 is      for (I = 0 ; I <J; I ++ )
 22 is         printf("%-7d",*(a+i));
23     printf("\n");
24     return 0;
25 }

 

operation result:

 

Guess you like

Origin www.cnblogs.com/bboykaku/p/12508052.html