cin.ignore() function is used to ignore inputs upto given range. If we write the statement like this − cin.ignore(numeric_limits::max(), ‘\n’) Then it ignores input including the new line character also. https://www.tutorialspoint.com/what-is-the-use-of-cin-ignore-in-cplusplus
Uhhh. So numeric_limits::max() doesn't include \n and we add \n too to tell cin.ignore() ignore it?
So if I understood correctly, it says: "Get maximum number of received characters and ignore it(meaning ignore all input), and ignore \n too" Right? @JRandomGuy
Correct. When you read something that makes part that wasn't read irrelevant.
Обсуждают сегодня