fork download
  1.  
  2. #include <iostream>
  3. #include <exception>
  4. #include <stdexcept>
  5. using namespace std;
  6. class E{};
  7. class X {
  8. public:
  9. static int c;
  10. X(int a) { c = a; }
  11. };
  12.  
  13. int X::c = 0;
  14.  
  15. void f(int i) {
  16. X* t[2];
  17. for(int j = 0; j < i; j++)
  18. t[j] = new X(i+1);
  19. for(int j = 0; j < i; j++)
  20. if (X::c++>2)
  21. cout<<"DD"<<X::c;
  22. // if(X::c++ > 2) throw new E;
  23. }
  24.  
  25. int main(void) {
  26. try {
  27. f(2);
  28. } catch(...) {
  29. cout << X::c;
  30. }
  31. return 0;
  32. }
  33.  
Success #stdin #stdout 0s 16048KB
stdin
Standard input is empty
stdout
DD4DD5