Hi guys:
The following code compares two folders and if the input is correct will print out the data. That's not my problem, I wanted to add an empty line when the comparison is incorrect. The things is that it adds a good amount of empty lines before I get the input. I tried a do while loop or two if statements and they gave me the same output. How can I get this to work ? Thank you,
Gus
Code
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main()
{
char cmpFile[20];
int numberRaw=486;
int numberImages = 100;
ifstream in,in2;
in.open("atos.comp");
in2.open("go.comp");
ofstream out("stdmag.comp");
double ierr,serr,verr,isn,iln,vn,x,y,sharp;
vector<double> bestId(numberImages);
vector<double> idil(numberImages);
vector<double> idis(numberImages);
vector<double> idv(numberImages);
vector<double> idile(numberImages);
vector<double> idise(numberImages);
vector<double> idve(numberImages);
vector<double> stardId(numberRaw);
for (int i=0; i<numberRaw; i++)
{
in2 >>stardId[i];
for(int j=0;j<numberImages;j++)
{
in >>bestId[j]>>idil[j]>>idile[j]>>idv[j]>>idve[j];
if (stardId[i]==bestId[j])
{
out <<" "<<idil[j]<<" "<<idile[j]<<" "<<idv[j]<<" "<<idve[j]<<" "<<bestId[j]<<endl;
}
/* if (stardId[i]!=bestId[j])
{
out <<endl;
}*/
}
}
out << endl;
return 0;
}
atos file (not entire file since the file is 24000+ lines)
9 12.417 0.005 10.109 0.005
15 12.786 0.005 10.500 0.005
16 12.322 0.005 10.887 0.005
19 12.481 0.005 11.096 0.005
26 13.035 0.006 11.215 0.006
29 13.823 0.005 10.926 0.005
40 14.187 0.005 11.132 0.005
44 14.521 0.006 11.160 0.006
65 13.639 0.005 12.083 0.005
66 14.244 0.008 11.844 0.008
69 13.671 0.006 12.148 0.005
75 14.447 0.005 11.899 0.005
79 13.918 0.006 12.201 0.005
88 14.219 0.005 12.194 0.005
95 14.208 0.005 12.314 0.005
go.comp file(same as atos file)
2
29
149
168
139
230
40
9
4
203
302
265
245
242
264
240
243
233
251