help with ignore

Mar 10, 2014 at 5:24am
Why does this work

istream & operator >> (istream & ins, Grade & G)
{
ins >> G.category >> G.date >> G.possible >> G.received;

getline(ins,G.name);

return ins;
}

and this doesn't?

istream & operator >> (istream & ins, Grade & G)
{
ins >> G.category >> G.date >> G.possible >> G.received;
cin.ignore(); // I only want this to ignore the white space before my getline
getline(ins,G.name);

return ins;
}
Mar 10, 2014 at 5:33am
cin is not ins.
Topic archived. No new replies allowed.