hello everyone.l am learning c++ on my own and i got confused with "cin.ignore() and cin.clear()".l searched alot on google but end up getting that these two are used to clear buffer again and again.
can anyone please elaborate these two in simple words.
Any help would be appreciated.
The cin.ignore() extracts and discards characters from the input buffer. By default it extracts and discards exactly one character.
Normally cin.clear() would first be called then you would ignore() all of the characters in the input buffer using the multi-argument version of ignore() that discards all input upto and including the end of line character.