online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> class X{ int val; public: X(int v){ std::cout<<"Constructor with value: "<<v<<"\n"; // no try - catch if(v<0){ std::cout<<"Invalid "<<v<<"\n"; throw 505; // exception code } std::cout<<"OK "<<v<<"\n"; this->val = v; } ~X(){ std::cout<<"Destructor with value: "<<this->val<<"\n"; } void someFunc(){ std::cout<<"Do something with value: "<<this->val<<"\n"; } }; int main() { // try - catch try{ X a = X(900); a.someFunc(); }catch(int e){ std::cout<<"Catch with exception code: "<<e<<"\n"; } try{ X b = X(0); b.someFunc(); }catch(int e){ std::cout<<"Catch with exception code: "<<e<<"\n"; } try{ X c = X(-999); c.someFunc(); }catch(int e){ std::cout<<"Catch with exception code: "<<e<<"\n"; } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue