online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// Tabla.cpp: ejemplo de Tabla // C con Clase: Marzo de 2002 #include <iostream> #include "Tabla.h" using namespace std; const int nElementos = 10; int main() { Tabla<int> TablaInt(nElementos); Tabla<float> TablaFloat(nElementos); for(int i = 0; i < nElementos; i++) TablaInt[i] = nElementos-i; for(int i = 0; i < nElementos; i++) TablaFloat[i] = 1.0f/(1.0f+i); for(int i = 0; i < nElementos; i++) { cout << "TablaInt[" << i << "] = " << TablaInt[i] << endl; cout << "TablaFloat[" << i << "] = " << TablaFloat[i] << endl; } return 0; }
// Tabla.h: definición de la plantilla tabla: // C con Clase: Marzo de 2002 #ifndef T_TABLA #define T_TABLA template <class T> class Tabla { public: Tabla(int nElem); ~Tabla(); T& operator[](int indice) { return pT[indice]; } int NElementos() const { return nElementos; } private: T *pT; int nElementos; }; // Definición: template <class T> Tabla<T>::Tabla(int nElem) : nElementos(nElem) { pT = new T[nElementos]; } template <class T> Tabla<T>::~Tabla() { delete[] pT; } #endif

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