-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?

Nil
  • 71
  • 9

1 Answers1

4

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
  • 1,933
  • 17
  • 17