Advertisement
edutedu

vr 78 pr 5

Sep 25th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char s[101], cuv[16], aux[100], *p;
  8. int k;
  9. cin.get(s, 101);
  10. cin>>cuv;
  11. k=strlen(cuv);
  12. p=strstr(s, cuv);
  13. if(!p)
  14. cout<<"nu apare";
  15. else
  16. {
  17. while(p)
  18. {
  19. strcpy(aux, p+k);
  20. strcpy(p+k, "?");
  21. strcpy(p+k+1, aux);
  22. p=strstr(p+k, cuv);
  23. }
  24. }
  25. cout<<"cuvantul modificat este: "<<s;
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement