I'm studying the different input errors in C++. I understand that !cin returns true when there's any problem establishing an input stream. But I can't clearly appreciate the difference with cin.fail(). Can anyone clarify it for me please?
Asked
Active
Viewed 704 times
-7
-
4What's unclear from the [documentation](http://en.cppreference.com/w/cpp/io/basic_ios/fail) – πάντα ῥεῖ Jun 25 '17 at 12:02
-
Possible duplicate of [Correct way to use cin.fail()](https://stackoverflow.com/questions/17928865/correct-way-to-use-cin-fail) – Ramesh-X Jun 25 '17 at 12:10
1 Answers
3
Both are same. fail
is a typical function where is '!' is an overloaded operator. You may want to check reference http://www.cplusplus.com/reference/ios/ios/fail/ before posting.

Chenna Reddy
- 2,241
- 18
- 17