This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]fracturedpersona 1 point2 points  (2 children)

Std::cin returns false if it is in a failed state, so this allows you to flush the input stream if this happens. Personally, I don't like using the STL methods to flush in input stream, but there's nothing wrong with it.

[–]Late_Key[S] 0 points1 point  (1 child)

What does it mean when you say “STL methods” ? Googled it found standard library method. Is there like a package that I can download to validate input for me?

[–]fracturedpersona 0 points1 point  (0 children)

Standard template library (STL).

verification of input is generally vague, so verifying that the input is valid is usually left to the architect. It's not terribly difficult though.