hello guys ...
I want to know your opinion about how to merge 2 different files ... for instance , File 1 contains
1 2 3 4
3 2 2 4
2 1 1 1
2 1 1 1
3 4 5 6
3 4 5 6
3 5 6 7
and File 2 contains
3 3.098
3 6.097
3 8.900
3 7.8
From these 2 files, you can see the number that is bold. You can see that, in File 1 , the bold number is 1 2 3 , whereas in File 2 the bold number is 3 . What I want to do is :
If the bold number in File 1 is 3 , then it will return the value of File 2 . For example :
In File 1, the second row shows 3 (bold number) , so it will return 3.098
and if the bold number is not 3, then it will return 100 ..
so the output should be like this :
1 2 3 4
3 2 2 4
2 1 1 1
2 1 1 1
3 4 5 6
3 4 5 6
3 5 6 7
100
3.098
100
100
6.097
8.900
7.8
I have tried code the program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
for(int i=0;i<noofneighbormesh;i++)
{
infile1 >> dummy1 >> n[i][0] >> n[i][1] >> n[i][2];
if(dummy1 == 3)
{
infile2 >> dummy2 >> eva_mesh[i];
outfile << eva_mesh[i] << endl;
}
else
{
outfile << "100" << endl;
}
}
|
can anyone help me on this problem ? thank you so much!!