Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include <cstdlib>
- const int MAX = 100000;
- using namespace std;
- void change (ifstream&, ofstream&, string&);
- int main()
- {
- string name;
- cout << "Enter name: ";
- cin >> name;
- ifstream in("input.cpp");
- ofstream out("output.cpp");
- if (in.fail() or out.fail())
- {
- cout << "!!!!!";
- exit (5);
- }
- change (in, out, name);
- in.close();
- out.close();
- return 0;
- }
- void change (ifstream& in, ofstream& out, string& name)
- {
- char temp[MAX];
- in.read(temp, MAX);
- string s = temp;
- s.replace(s.find("#N#"), 3, name);
- out << s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement