I am e c++ beginner. I have a 6 columns and 6 million rows text file of numerical integer values (up to 12 digits) and I must compare, line by line, numbers in col. 1, 3 and 5: they should be the same number: if not, the code shuold send me a warning specifying the row. I tried using this code:
int main() {
int time1, time2, time3, n1, n2, n3;
string fileinp;
cout << "input file: ";
cin >> fileinp;
int nlines = 0;
ifstream f1(fileinp.c_str());
while (!f1.eof()) {
nlines = nlines+1;
f1 >> time1 >> n1 >> time2 >> n2 >> time3 >> n3;
//cout << nlines << " " << time1 << endl;
if(time1 != time2 || time2 != time3 || time1 != time3) {
cout << "timestamp not corresponding for event n. " << nlines << endl;
}
}
cout << nlines << endl;
f1.close();
}
but the program always reads the first line: how can I go to the next line in the "while" loop? Thanks