cpp errorsCatching Errors

Catching Errors

Learn C++ in step-by-step lessons.


If you can prevent an error from occurring, it is much better. For instance you can always avoid a divide by zero error by testing with a statement such as if(divisor!=0) before dividing.

However, there are sometimes situations when you need to catch an error.


Please study the material at each of the links below.

  1. Reading integers
  2. Reading doubles
  3. Finding a total
  4. Input a date as mm/dd/year
  5. Check for leap year
GlossaryGlossary for errors lesson
Full Glossary