Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- void main()
- {
- ifstream iFile("file.in");
- ofstream oFile("file.out");
- string line;
- int index = -1;
- while (iFile >> line)
- {
- index = line.find("Hello");
- if (index != string::npos)
- line.replace(index, sizeof("World") - 1, "World");
- oFile << line;
- }
- iFile.close();
- oFile.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement