online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
//3.cpp #include <iostream> #include <cstdlib> #include <string> using namespace std; int main(){ int i, j; int *tablaB; string **tablaA; string **Trpta; int f=9, c=2; string t1A[f][c] = { {"VIDAL", "ASISTENTE" }, {"MORALES", "VENTAS" }, {"SANZ", "VENTAS" }, {"IGLESIAS","GERENTE" }, {"MARTIN", "VENTAS" }, {"VAZQUEZ", "GERENTE" }, {"MORENO", "GERENTE" }, {"JIMENEZ", "ANALISTA" }, {"GARCIA", "PRESIDENTE"}, }; int t1B[f] = { 800, 1600, 1250, 2975, 1250, 2850, 2450, 3000, 5000, }; // ASIGNANDO MEMORIA A LA TABLA A tablaA = new string*[f]; for(i=0; i<f; i++){ tablaA[i] = new string[c]; } // ASIGNANDO MEMORIA A LA TABLA B tablaB = new int[f]; for(i=0; i<f; i++){ tablaB[i] = t1B[i] ; } // IMPRIMIENDO LA TABLA A Y B cout<<"**********\n"; for(i=0; i<f; i++){ //imprimiendo la tabla A for(j=0; j<c; j++){ tablaA[i][j] = t1A[i][j] ; cout<<tablaA[i][j]<<" " ; } // imprimiendo la tabla B cout<<tablaB[i]<<" \n" ; } cout<<"----------\n" ; // SE BUSCA EN EL ARRAY string buscar = "GERENTE"; cout<<"\nEL PUESTO ES: "<<buscar<<"\n"""; int f_ = 0; int c_ = 2; // contamos las búsquedas for(i=0; i<f; i++) if( !tablaA[i][1].find(buscar) ) f_++; // asignamos memoria al nuevo arreglo de resultados de búsquedas Trpta = new string*[f]; for(i=0; i<f_; i++) Trpta[i] = new string[c_]; // copiamos los resultados al nuevo arreglo int tmp=0; // char tmpnum[20]; string tmpnum; int sum = 0; for(i=0; i<f; i++){ if( !tablaA[i][1].find(buscar) ){ Trpta[tmp][0] = tablaA[i][0]; // itoa(tablaB[i],tmpnum,10); tmpnum = to_string(tablaB[i]); Trpta[tmp][1] = tmpnum; sum = sum + tablaB[i]; tmp++; } } cout<<"----------\n" ; // IMPRIMIENDO LOS RESULTADOS DE LA BÚSQUEDA for(i=0; i<f_; i++){ cout<<"Find2: "<<Trpta[i][0]<<" "<<Trpta[i][1]<<"\n"; } cout<<"\nEl promedio de SUELDO es: "<<(1.0*sum/f_); // LIBERANDO MEMORIA DE LA TABLA A y RESULTADOS delete[] tablaA; delete[] Trpta; return 0; }

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