Advertisement
Cucura_Georgiana

Varianta 2019, Subiect 3

Nov 20th, 2019
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. (Sesiunea specială, 29 mai 2019)
  2. (Incercare)
  3.  
  4. 2.  #include<iostream>
  5. #include<cstring>
  6. using namespace std;
  7. char x[1001], *p;
  8. int main()
  9. {
  10.     int i, n, c=0;
  11.     cin>>n;
  12.     cin.get();
  13.     cin.getline(x, 1001);
  14.     p=strtok(x, " ");
  15.     while(p!=0)
  16.     {
  17.         c++;
  18.         if(strlen(p)==n)
  19.         {
  20.             cout<<p<<'\n';
  21.         }
  22.         if(strlen(p)!=n)
  23.         {
  24.             c--;
  25.         }
  26.         p=strtok(0, " ");
  27.     }
  28.     if(c==0)
  29.     {
  30.         cout<<"nu exista";
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement