Output from a file

So I'm trying to output information in a file into the values however I cant figure out how to separate them properly and make it output the entire file.

The .txt has this in it:
1
2
3
4
5
6
7
8
9
12345
R
790
29888
X
38116
P
375
982


So heres what i got so far but for some reason it doesnt even start reading from the beginning of the file and skips the first 3 lines

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
26
27
28
29
30
31
	fstream inputStream;
	int number, minutes, dayMinutes, nightMinutes;
	char code;

	inputStream.open("billingdata.txt");

	inputStream >> number;
	inputStream >> code;
	inputStream >> minutes;
	inputStream >> dayMinutes;
	inputStream >> nightMinutes;

	while (inputStream >> number >> code)
		{
				cout << "Enter ID: " << number << endl;
				cout << "Enter code: " << code << endl;

			if (code == 'r' || code == 'R')
			{
				cout << "Enter minutes: " << minutes << endl;
			}
			else if (code == 'p' || code == 'P')
			{
				cout << "Enter day minutes: " << dayMinutes << endl;
				cout << "Enter night minutes: " << nightMinutes << endl;
			}
			else
			{
				cout << "Invalid code" << endl;
			}
	}


I want the output to look somewhat like this:
Enter ID: 12345
Enter code: R
Enter minutes: 790
Enter ID: 29888
Enter code: X
Invalid code
Enter ID: 38116
Enter code: P
Enter day minutes: 375
Enter night minutes: 982

Try to explain it in the most basic terms if you can
Thanks
It's easier to show the code than to explain it:
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
26
27
28
    fstream inputStream;

    int number, minutes, dayMinutes, nightMinutes;
    char code;

    inputStream.open("billingdata.txt");

    while (inputStream >> number >> code)
    {
        cout << "Enter ID: " << number << endl;
        cout << "Enter code: " << code << endl;

        if (code == 'r' || code == 'R')
        {
            inputStream >> minutes;
            cout << "Enter minutes: " << minutes << endl;
        }
        else if (code == 'p' || code == 'P')
        {
            inputStream >> dayMinutes >> nightMinutes;
            cout << "Enter day minutes: " << dayMinutes << endl;
            cout << "Enter night minutes: " << nightMinutes << endl;
        }
        else
        {
            cout << "Invalid code" << endl;
        }
    }
Topic archived. No new replies allowed.