As I mentioned in my comment, you read one line with:
getline (myfile,line);
and then if the line has v
in the first position you read another line with this statement:
myfile >> v >> valuesX[n]>> valuesY[n]>> valuesZ[n];
but you do not process the previous line read in with the getline
so you will lose that line. One possible solution is to process each line
that matches using istringstraeam
:
std::istringstream iss( line );
iss >> v >> valuesX[n]>> valuesY[n]>> valuesZ[n];