Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int x, y;
  7.  
  8. try
  9. {
  10. cout << "Enter dividend and divisor respectively" << endl;
  11. if (y == 0)
  12. {
  13. throw y;
  14. cout << "After throw (Never executed) \n";
  15. }
  16. }
  17. catch (int x )
  18. {
  19. cout << "Can't Divide by 0" << endl;
  20. }
  21.  
  22. cout<< "This will be executed";
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement