Extra output from program

I am trying to make this program output the data from a file showing names and birthdays. At the end of the output, it shows the last date again (with the setw) but not the name. How do I make it so it doesn't show the last date twice. Here is the code:
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
#include <iostream>
using namespace std;
#include <fstream>
#define FILE "../../birthday/birthday/birthday.txt"
#include <iomanip>

struct dob
{int m,d,y;};

int main()
{
	char name[50];
	char slash;
	dob date;
	cout << "Name          Date of Birth\n\n";
	ifstream input;
	input.open(FILE, ios::in);
	do{
	input.getline(name,49,'?');
	input >> date.m >> slash >> date.d >> slash >> date.y;
	cout << name << setw(10) << date.m << "\\" << date.d << "\\" << date.y << endl;}
	while(!input.eof());
	cin.get();
	return 0;
}
You have to check the stream after line 20 to see if the input operation succeeded.
How do I do that?
You just need to move the breaking condition where jsmith said
1
2
3
if ( input.eof() )
    //No more characters in the file
    break;//terminate the loop 

It worked. Thank you both for the help.
Topic archived. No new replies allowed.