I am trying to copy 2 files into 1 file like ID1 . name1 . ID2 . name2 . but i cant do it...how am i supposed to copy each line from each file.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream file1("ID.txt");
ifstream file2("fullname.txt");
ofstream file4("test.txt");
string x,y;
while (file1 >> x )
{
file4 << x <<" . ";
while (file2 >> y)
{
file4 << y <<" . "<< endl;
}
}
}