Advertisement
gatsbre

pbinfo #1000 CNP

Apr 24th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4. using namespace std;
  5. ifstream fin("cnp.in");
  6. ofstream fout("cnp.out");
  7. char cuvant[2000];
  8. char CNP[2000],aux[1];
  9. bool ok;
  10. int main()
  11. {
  12.     while(!fin.eof())
  13.     {
  14.  
  15.         fin.get(cuvant,200);
  16.         fin.get();
  17.         int i = 0;
  18.         while(i < strlen(cuvant))
  19.         {
  20.             while(isdigit(cuvant[i]))
  21.             {
  22.                 aux[0]=cuvant[i];
  23.                 strcat(CNP, aux);
  24.                 i++;
  25.             }
  26.             if(strlen(CNP)==13)
  27.                 fout << CNP << endl,
  28.                 ok = true;
  29.             strcpy(CNP,"");
  30.             i++;
  31.         }
  32.     }
  33.     if(!ok)
  34.         fout << 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement