Wrong getline. You need a standalone function provided with std::string
std::getline( in, name );
http://www.cplusplus.com/reference/string/string/getline/
If the in.txt really has a header line 1 like that, then you have to skip it by reading/ignoring that line first.
The loop.
At start (if) the in is ok, so you start reading. What if any of lines 15-19 fails? You won't get all values of one record. Consider
while ( A && B && C && D && E )
, where the A-E are the getline invocations.
The && is "lazy", i.e. if the expression one the left is false, then the expression on the right is not evaluated at all.
What is left to do inside the body of the loop? Your five strings now hold one record. On every iteration they are overwritten by the next batch of getlines. Therefore, would you have to copy the values to somewhere before next iteration. To a container: array, list, vector, etc.
Another note: if the file is known to contain exactly one record, then a 'while' is not appropriate.
1 2 3 4
|
if ( A && B && C && D && E )
{
// print the values
}
|