Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. void main()
  7. {
  8.     ifstream iFile("file.in");
  9.     ofstream oFile("file.out");
  10.     string line;
  11.  
  12.     int index = -1;
  13.     while (iFile >> line)
  14.     {
  15.         index = line.find("Hello");
  16.         if (index != string::npos)
  17.             line.replace(index, sizeof("World") - 1, "World");
  18.         oFile << line;
  19.     }
  20.     iFile.close();
  21.     oFile.close();
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement