Advertisement
icatalin

problema cuvinte3 pbinfo NETERMINATA ( e si pe pbinfo )

Feb 11th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. ifstream f("cuvinte3.in");
  8. ofstream g("cuvinte3.out");
  9.  
  10. char v[101][30],s[256],sep[]=".,;:-?!";
  11. int n;
  12.  
  13. int cauta(char *p)
  14. {
  15. int i;
  16. for (i=1;i<=n;i++)
  17. if (strcmp(v[i],p)==0)
  18. return 0;
  19. return 1;
  20. }
  21.  
  22. int main()
  23. {
  24. char *p;
  25. int i;
  26. while (f.getline(s,256))
  27. {
  28. p=strtok(s,sep);
  29. while (p)
  30. {
  31. if (cauta(p)==1 && strstr(p,"ate"))
  32. {
  33. n++;
  34. strcpy(v[n],p);
  35. }
  36. p=strtok(NULL,sep);
  37. }
  38. }
  39. for (i=1;i<=n;i++)
  40. g<<v[i]<<'\n';
  41.  
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement