What's a better way to clear cin input? I thought cin.clear and cin.ignore was a good way...?
code:
void clearInput()
{
cin.clear();
cin.ignore(1000,'\n');
//cin.ignore( std::numeric_limits<streamsize>::max(), '\n' );
}
My teacher gave me this reply...
this is basically saying that your clearInput doesn't work FYI: ignore is NEVER a good idea as a way of getting rid of all that remains on a line
and your failing this test is exactly the reason why now go clear it the correct way
She has also told me this following:
on ignore you need to guess at how many characters you want to ignore If you absolutely know your data and it follows a strict format -- as in Excel spreadsheets, ignore is really good. If you are NOT in this type of file, then you NEVER use ignore. Question, is your data well-formed? If yes, use ignore. If not, don't use ignore.
List ALL the way of getting data? 1) there is extraction >>
and there is also??????
please list for me