John has some data in his laptop saved in two different files, but now he wants to add the data in one file to another file. Write a program to complete John's task.
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream in("one.txt");
ofstream out("another.txt", ios_base::out | ios_base::app);
for (string str; getline(in, str); ) {
out << "\n" << str << "\n";
}
return 0;
}
Comments
Leave a comment