void NewCustInfo(CustData &cust)
{
	cout << "Customer Name: ";
	getline(cin, cust.name);

}

CustData is a structure that is declared, and the name data member of that struct is of type string. For some reason when I call this function(there are no compile errors), it displays the cout statement, but then completely skips over the getline function. Any ideas?

Thanks

Does it occur after some other input? If so, there may be still be some lagging information in the input stream that it's grabbing.

Try placing cin.ignore(); directly before it.

Edited 6 Years Ago by Fbody: n/a

void NewCustInfo(CustData &cust)
{
	cout << "Customer Name: ";
	getline(cin, cust.name);

}

CustData is a structure that is declared, and the name data member of that struct is of type string. For some reason when I call this function(there are no compile errors), it displays the cout statement, but then completely skips over the getline function. Any ideas?

Thanks

Its probably most likely that there is a new line character in the stream. This happens when you read in a number. As suggested,
place cin.ignore() as the first statement in the function. Then go
on normally.

Thanks guys, that fixed my problem. I shoulda been able to figure that out on my own =(

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