Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- void fin_file(ifstream& fin, ofstream& fout, char& next);
- void fout_file(ifstream& fin, ofstream& fout, char& next);
- void write_file(ifstream& fin, ofstream& fout, char& next);
- void closing_message();
- int main()
- {
- char next;
- ifstream fin;
- ofstream fout;
- fin_file(fin,fout,next);
- closing_message();
- return 0;
- }
- void fin_file(ifstream& fin, ofstream& fout, char& next)
- {
- fin.open("input.txt");
- if(!fin.fail()) {
- fout_file(fin, fout, next);
- }
- return ;
- }
- void fout_file(ifstream& fin, ofstream& fout, char& next)
- {
- fout.open("output.txt");
- if(!fout.fail()) {
- write_file(fin, fout, next);
- }
- return ;
- }
- void write_file(ifstream& fin, ofstream& fout, char& next)
- {
- fin.get(next);
- while(next != '\n')
- {
- fout.put(next);
- fin.get(next);
- }
- fin.putback(next);
- }
- void closing_message()
- {
- cout << "End of program\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement