fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define ll long long
  5. #define el '\n'
  6. const int MOD = 1e9 + 7;
  7.  
  8. double devided(int a, int b) {
  9. if (b == 0)
  10. throw 1;
  11. return a/b;
  12. }
  13.  
  14. int main() {
  15.  
  16. try {
  17. cout << devided(10, 2) << endl;//✅
  18. cout << devided(5, 2) << endl;//✅
  19. cout << devided(2, 0) << endl;//Stops Here
  20. cout << devided(3, 1) << endl;//❌
  21. }catch (int a) {
  22. cout << "Error" << endl;
  23. }
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
5
2
Error