Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. ifstream f("inserarechar.in");
  4. ofstream g("inserarechar.out");
  5. char a[20],s[256],*p,aux[1000];
  6. int main()
  7. {
  8. bool ok=0;
  9. f>>a;
  10. f.get();
  11. f.get(s,256);
  12. p=strtok(s," ");
  13. while(p)
  14. {
  15. bool ok1=1;
  16. if(strlen(p)!=strlen(a))
  17. ok1=0;
  18. else
  19. for(int i=0; i<strlen(p); i++)
  20. if(p[i]!=a[i])
  21. ok1=0;
  22. if(ok1==1)
  23. {
  24. strcat(aux,p);
  25. strcat(aux,"? ");
  26. ok=1;
  27. }
  28. else
  29. {
  30. strcat(aux,p);
  31. strcat(aux," ");
  32. }
  33. p=strtok(NULL," ");
  34. }
  35. if(ok==0)
  36. g<<"NU APARE";
  37. else
  38. g<<aux;
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement