-7

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?

1 Answers1

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. enter image description here

Chenna Reddy
  • 2,241
  • 18
  • 17