online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <array> #include <exception> #include <memory> #include <string> #include <iostream> class Person { protected: std::string name_; int tasksCompleted_; public: const std::string& whoIs() const { return name_; } int numberTasksCompleted() const { return tasksCompleted_; } virtual void performTask() = 0; protected: explicit Person(const std::string& name) : name_{ std::move(name) } {} virtual ~Person() = default; }; class Bodine final : public Person { private: static int currentTask; public: explicit Bodine(const std::string& name = std::string("Bodine")) : Person(name) {} virtual ~Bodine() = default; virtual void performTask() { currentTask++; tasksCompleted_ = currentTask; } }; int Bodine::currentTask = 0; class Finn final : public Person { private: static int currentTask; public: explicit Finn(const std::string& name = std::string("Finn")) : Person(name) {} virtual ~Finn() = default; virtual void performTask() { currentTask++; tasksCompleted_ = currentTask; } }; int Finn::currentTask = 0; class Tycho final : public Person { private: static int currentTask; public: explicit Tycho(const std::string& name = std::string("Tycho")) : Person(name) {} virtual ~Tycho() = default; virtual void performTask() { currentTask++; tasksCompleted_ = currentTask; } }; int Tycho::currentTask = 0; int main() { try { std::array<std::shared_ptr<Person>, 3> people{ std::shared_ptr<Person>(new Bodine()), std::shared_ptr<Person>(new Finn()), std::shared_ptr<Person>(new Tycho()) }; // For each person in array const int MAX_TASKS = 7; int currentPerson = 0; for (auto& p : people) { std::cout << p->whoIs() << " has performed task #:\n"; while (p->numberTasksCompleted() < 7) { p->performTask(); std::cout << p->numberTasksCompleted() << '\n'; if (p->numberTasksCompleted() == MAX_TASKS) { currentPerson++; if (currentPerson <= (people.size() - 1) ) { std::cout << "It's your turn " << people[currentPerson]->whoIs() << " to do some tasks.\n"; } break; } } } } catch( std::runtime_error& e ) { std::cerr << e.what() << std::endl; return EXIT_FAILURE; } return EXIT_SUCCESS; }

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