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> #include <iomanip> using namespace std; const int maxtam=50; void imprime_matriz(float[][maxtam+1],int); bool eliminacion(float A[][maxtam+1], int n, int k){ float m = A[n-k][n-k]; if(m==0) return false; for(int s=n-k; s<=n; s++){//para cada columna de la submatriz k x k+1 A[n-k][s] = A[n-k][s]/m; } for(int j=0; j<n; j++){// para cada fila de la submatriz if (j==n-k) continue; m = A[j][n-k]/A[n-k][n-k]; for (int s=n-k; s<=n; s++){//para cada columna de la submatriz k x k+1 A[j][s] = A[j][s] - m*A[n-k][s]; } } if(k==1){ return true; }else{ eliminacion(A, n, k-1); //pasamos a una submatriz k-1 x k } } int main(){ float A[maxtam][maxtam+1] = { 0.0 }; float coef[] = {1, -2, 1, 0, 2, 1, -3, 5, 4, -7, 1, -1 }; int n=3; if ( n*(n+1) != sizeof(coef)/sizeof(coef[0]) ){ cout<<"Error en el ingreso de coeficientes."<<endl; return 1; } for(int i=0; i<n; i++ ) for(int j=0; j<=n; j++ ){ A[i][j]= coef[j+ (n+1)*(i)]; } cout<<"Sistema original"<<endl; imprime_matriz(A, n);cout<<endl; if(eliminacion(A, n, n)){ cout<<"La solucion es."<<endl; for (int i = 0 ; i<n; i++ ){ cout<<"x"<<i+1<<"="<<A[i][n]<<endl; } } else cout<<"No hay solucion unica."<<endl; } void imprime_matriz(float A[][maxtam+1], int n){ for(int i=0; i<n; i++){ for(int j=0; j<=n; j++){ cout<<setw(3)<<A[i][j]; } cout<<endl; } }

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