Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include<cstring>
  3. #include<fstream>
  4. using namespace std;
  5. char s[101],a[11],b[11],*p,t[101];
  6.  
  7. int main()
  8. { ifstream fin("inlocuirecuvant.in");
  9. ofstream fout("inlocuirecuvant.out");
  10. fin>>a;
  11. fin>>b;
  12. fin.get();
  13. fin.getline(s,101);
  14. p=strtok(s," ");
  15. while(p)
  16. {
  17. if(strcmp(p,a)==0)
  18. strcat(t,b);
  19. else
  20. strcat(t,p);
  21. strcat(t," ");
  22. p=strtok(NULL," ");
  23. }
  24. fout<<t;
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement