2082 10

Object Oriented Programming20825 marksException handling definition and purpose

Write a program to handle division by zero exception using try, catch, and throw.

Write a program to handle division by zero exception using try, catch, and throw. [5]

In C++, exception handling uses three keywords: - try - block of code that may throw an exception - throw - used to throw/raise an exception when an error occurs - catch - block that handles the thrown exception --- --- Case 1: Normal Division Case 2: Division by Zero --- Keyword Role in Program ...

Up nextWrite a C++ program to read a text file named data.txt and display its contents on the scr