Learn C++ in step-by-step lessons.
Catching Errors
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.
Goals:
- Be able to use the try catch control structure
Objectives:
Please study the material at each of the links below.
- Reading integers
- Reading doubles
- Finding a total
- Input a date as mm/dd/year
- Check for leap year
Glossary for errors lesson
Full Glossary