online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <string_view> class Trouble { public: explicit Trouble(std::string_view message="There is a problem") :m_message{message}{} std::string_view what()const{return m_message;} private: std::string m_message{}; }; void trySomething(size_t inti) { switch (inti) { case 0: throw Trouble ("Error message 1"); break; case 1: throw Trouble ("Error message 2"); break; case 4: throw Trouble ("Last Error message"); break; default: throw Trouble (); break; } } int main() { for (size_t i{};i<5;++i) { try { trySomething(i); }catch (const Trouble& trouble) { std::cout<<"Exception#: "<<trouble.what()<<std::endl; } } }

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