Advertisement
Guest User

prob 12

a guest
Feb 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     char a[]="ana are 5 rosii, 7 mere si 223 de pere. ea are si 54 de bomboane si 8 napolitane";
  9.     char cifre[256];
  10.     int i=0;
  11.     for(int i=0; i<=256; i++)
  12.         cifre[i++]='/0';
  13.  
  14.     char *p=a;
  15.     for(p; *p; p++)
  16.         if(*p>'0' && *p<='9')
  17.             cifre[i++]=*p;
  18.         else
  19.             cifre[i++]='_';
  20.     int j=0;
  21.     while(j<i)
  22.     {   while(cifre[j]!='_')
  23.         {
  24.             cout<<cifre[j];
  25.             j++;
  26.         }
  27.         while(cifre[j]=='_')
  28.             j++;
  29.         cout<<" ";
  30.     }
  31.  
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement