Reading one number from on the input then stopping the loop

For the following code, I have to read in the ID number, grade and credit hours..But I have to read in the ID number by itself.
How do I do that? This what I have so far..


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
32
33
34
35
36
37
38
39
40
//Program Assignment 4
//Thomas Powe 3-20-12
//CS207

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <stdlib.h>
using namespace std;

//function prototypes go 
//double findGPA(double points, double hours);
int main()
{
	double gpa, points, hours, ID, grade, crhrs;
	
	ofstream OutputFile;
	OutputFile.open("Output.dat");

	ifstream infile;
	infile.open("Input.dat");

	OutputFile<<setw(30)<<"Thomas Powe"<<endl;
	OutputFile<<setw(29)<<"03-27-12"<<endl<<endl;
	OutputFile<<setw(15)<<"ID"<<setw(18)<<"GPA"<<endl<<endl;
//infile>>ID;
while (!infile.eof())
{
	while (infile>>ID)
	{
		break;
	}
	OutputFile<<setw(15)<<ID<<setw(18)<<"Comin Soon"<<endl;
	}
infile>>ID;
	OutputFile.close();
	infile.close();
	return 0; 
}


And this is the output I'm getting

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
     Thomas Powe
                     03-27-12

             ID               GPA

          30713        Comin Soon
              4        Comin Soon
              3        Comin Soon
              3        Comin Soon
              4        Comin Soon
              3        Comin Soon
              3        Comin Soon
              2        Comin Soon
              3        Comin Soon
              4        Comin Soon
              3        Comin Soon
          21356        Comin Soon
              4        Comin Soon
              4        Comin Soon
              4        Comin Soon
              3        Comin Soon
              3        Comin Soon
              3        Comin Soon
              2        Comin Soon
              3        Comin Soon
              2        Comin Soon
              3        Comin Soon
          21265        Comin Soon
              4        Comin Soon
Topic archived. No new replies allowed.