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, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <iostream> using namespace std; class Employee { protected: string name; int number, weight; public: Employee() {} Employee(string name, int number, int weight) { this->name = name; this->number = number; this->weight = weight; } void getData() { cout << "Enter Employee Name " << endl; cin >> this->name; cout << "Enter Employee Number " << endl; cin >> this->number; cout << "Enter Employee Weight " << endl; cin >> this->weight; } virtual void putData() { cout << "Employee Name: " << this->name << ", Employee Number: " << this->number << ", Employee Weight:" << this->weight << endl; } bool isOverweight() { return this->weight > 90; } }; class Manager : public Employee { protected: string title; public: Manager() {} Manager(string name, int number, int weight, string title) : Employee(name, number, weight) { this->title = title; } void getData() { Employee::getData(); cout << "Enter Manager Title " << endl; cin >> this->title; } void putData() { Employee::putData(); cout << "Manager Title: " << this->title << endl; if (Employee::isOverweight()) cout << "Manager is overweight" << endl; else cout << "Manager is not overweight" << endl; } }; class Scientist : public Employee { protected: int numberOfPublications; public: Scientist() {} Scientist(string name, int number, int weight, int numberOfPublications) : Employee(name, number, weight) { this->numberOfPublications = numberOfPublications; } void getData() { Employee::getData(); cout << "Enter Scientist Number Of Publications " << endl; cin >> this->numberOfPublications; } void putData() { Employee::putData(); cout << "Scientist Number Of Publications: " << this->numberOfPublications << endl; if (Employee::isOverweight()) cout << "Scientist is overweight" << endl; else cout << "Scientist is not overweight" << endl; } }; int main() { Manager *m = new Manager("Samir", 1, 85, "CTO"); Scientist *s = new Scientist("Ahmed", 2, 95, 23); Employee *employess[2] = {m, s}; for (int i = 0; i < 2; ++i) { employess[i]->putData(); } }

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