1.

What are the similarities and differences between bad() and fail() functions.

Answer»

Similarities: bad() and fail() both are error handling functions and return true if a reading or writing operation fails. 

Differences: Both bad() and fail() return true if a reading or writing operation fails but fail() also returns true in the case that a format error happens, like when an alphabetical character is extracted when we are trying to read an integer number. 



Discussion

No Comment Found

Related InterviewSolutions