in.open(filename.c_str(), ifstream::in);
string name, email, group;
while (in >> name >> email >> group) {
in >> name >> email >> group;
cout << name << email << group);
...
}
in.close();
Consider this code where in is of type ifstream and filename is the name of the file from which we read the data. Format of input file is perfectly fine – many lines with 3 string in each.
This piece should simply print all of the data in the file but what id does is printing all of the lines except for the first line. Why is the first line skipped?
Drop
in >> name >> email >> group;from the body of the loop. The one in the condition is enough.