Advertisement
anamariakiss1

inlocuire in txt c1 cu c2

Nov 10th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include<cstring>
  3. #include<stdio.h>
  4. using namespace std;
  5.  
  6. int main()
  7. { char s[256],c1[20],c2[20],sep[]=" .,",*p;
  8. aux[256];
  9. gets(s);
  10. gets(c1);
  11. gets(c2);
  12. p=strtok(s,sep);
  13. while(p)
  14. {
  15. if(strcmp(p,c1)==0)
  16. {
  17. strcpy(aux,p);
  18. strcpy(p,c2);
  19. strcpy(c2,aux);
  20. }
  21. cout<<p<<" ";
  22. p=strtok(NULL,sep);
  23. }
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement