Having trouble with nested loops in fstream program

I'm doing a simple assignment and I'm having trouble outputting the intended output. Can someone help me gain direction in figuring out where the issue is? We're not allowed to use istringstream.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    else
    {
       upData >> houseIdent;

       while(upData)
       {

         do{
                upData >> vehType >> plate >> year >> vehPrice;

                calculate = calcReg(vehType, plate, year,
                                vehPrice);

                outDataOne << fixed << showpoint << setprecision(2);
                outDataOne << ' ' << vehType << ' ' << plate << ' ' << calculate
                           << endl;


                ch = upData.peek();

          }while (upData && (ch != '\n'));  

          upData >> houseIdent;

    }

upData is the ifstream .txt and outDataOne is the ofstream .txt. The input is similar to this

11111 M DKC294 2007 23001 A VID392 2010 10390
22222 A DKS382 2011 20390
33333 A DKF329 2001 30920 M AJD302 2004 15509

The output I keep getting though is the first two output lines are correct but then the third line doesn't go back and read the 2nd line ID number, but keeps 11111 as the ID number while putting the vehType as 2 and the plate as 0390. I'm so confused with this as I am fairly new to C++.
Topic archived. No new replies allowed.