You increase your counter twice in every iterationCode:for(int iTwo = 1; iTwo <= 5; iTwo++) { (getline(inputFile, valuePortion));//while eof marker not found in file, read until iTwo++;
so the loop is processed for iTwo == 1, 3, 5 is that what you planned to do?