online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include<iostream> #include <cstring> using namespace std; class Muncitor { char *nume; int vechime; static int count; public: Muncitor(); Muncitor(char *,int); friend istream& operator >>(istream &, Muncitor &); friend ostream& operator <<(ostream &, const Muncitor &); static int afisare_count(); }; int Muncitor::count = 0; int Muncitor::afisare_count() { return count; } Muncitor::Muncitor() { this->nume = new char(4); strcpy(nume,"Gol"); this->vechime = 0; } Muncitor::Muncitor(char *nume, int vechime) { this->nume = new char(strlen(nume)+1); strcpy(this->nume,nume); this->vechime = vechime; count++; } istream& operator >>(istream &is, Muncitor &m) { is.getline(m.nume,100); is >> m.vechime; return is; } ostream& operator <<(ostream &os, const Muncitor &m) { os<<m.nume<<" "<<m.vechime; return os; } int main() { int n; cin>>n; Muncitor **a; a = new Muncitor*[n]; for(int i=0;i<n;i++) { a[i] = new Muncitor; cin >> *a[i]; } for(int i=0;i<n;i++) { cout << a[i] << endl; } cout<<"Count = "<<Muncitor::afisare_count(); }

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