whenever i use cin.get in a loop it skips over the first cin.get. for example, in the code below, the programs skips over the cin.get for the stu.name??

#include<iostream.h>
#include<fstream.h>

struct student
{
	char name[20];
	char ssn[20];
	char dob[20];
	float gpa;
};

main()
{
	student stu;
	ofstream outfile;
	char choice;

	outfile.open("h:/name.dat", ios::out);

	do{
		cout << "What's your name?" <<endl;
	cin.get(stu.name, 20);//**skips this line in the 2nd loop???
	cin.ignore(80, '\n');

	cout << "What's your GPA?" <<endl;
	cin >> stu.gpa;
	
	cout << "What's your date of birth?" <<endl;
	cin.get(stu.dob, 20);
	cin.ignore(80,'\n');

	cout << "What's your social security number?" <<endl;
	cout << "xxx-xx-xxx" <<endl;
	cin.get(stu.ssn, 20);
	cin.ignore(80, '\n');

	

	cout << " " <<endl;
	cout << " " <<endl;

	cout << stu.name <<endl;
	cout << stu.ssn <<endl;
	cout << stu.dob <<endl;
	cout << stu.gpa <<endl;

	

	if (outfile)
	{
		outfile << stu.name <<endl;
		outfile << stu.ssn <<endl;
		outfile << stu.dob <<endl;
		outfile << stu.gpa <<endl;
	}
	else
	{
		cout << "An error has occured while opening the file." <<endl;
	}
	cout << "Enter q to quit" <<endl;
	cin >> choice;
	}
	while(choice != 'q');
	outfile.close();

	return 0;
}

<< moderator edit: added [code][/code] tags >>

all the cin.get's work on the first loop but on subsequent loops it skips over the first cin.get??

This question has already been answered. Start a new discussion instead.