Hi everyone,
I have 4 file.txt individually, I want to add to one file with 4 columns.
I can add file, but, no making to 4 columns.
How can fix it?
Thank you too much.
This code is:............
int docfile(int);
//--------------------------------------OPEN FILE AND READ IT------------------------------------------------
int docfile(int n)
{
int i;
int k,l;
int a[1][N];
char f[100];
char r[100];
cout<<"So luong file can nhap: ";
cin>>n;
for (i=0; i<n; i++){
cout<<"Nhap ten file"<<endl;
cin>>f;
ifstream openfile(f,ios::in);
if (openfile.is_open()){
for (k=0;k<1;k++) {
for (l=0;l<N;l++){
openfile>>a[k][l];
if (l<=2) a[k][l]=0;
cout<<a[k][l]<<endl;
//a[j][i]=a[j][i];
outfile<<openfile.rdbuf()<<endl;
Conceptually it is really easy:
1. Take one line from each file. You get strings.
2. Concatenate strings together and write the result to output.
3. Repeat from 1.