online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> #include <cstdlib> #include <time.h> #define n 3 using namespace std; int main() { srand(time(NULL)); int A[n][n], B[n*n], i, j, numVeces, aux; // ASIGNAMOS VALORES ALEATORIOS AL ARREGLO A cout<<"Matriz 2D: "<<endl; for(i=0; i<n; i++) for(j=0; j<n; j++) A[i][j] = 1+rand()%100; // IMPRIMIMOS EL ARREGLO A for(i = 0; i < n; i++){ for(j = 0; j < n; j++) cout << A[i] [j] << " "; cout << endl; } // PASAMOS LA MATRIZ A HACIA UN VECTOR B cout<<endl<<"Matriz 1D: "<<endl; for(i=0; i<n; i++) for(j = 0; j<n; j++) B[i*n+j] = A[i][j]; // IMPRIMIMOS EL VECTOR B for (i=0; i<n*n; i++) cout<<B[i]<<" "; // ORDENAMOS EL VECTOR B DESCENDIENTEMENTE for (numVeces=1; numVeces<n*n; numVeces++) for (i=0; i<n*n-1; i++) if (B[i] < B[i+1]) { aux = B[i]; B[i] = B[i+1]; B[i+1] = aux; } // IMPRIMIMOS EL VECTOR B ORDENADO cout<<endl<<endl<<"Matriz 1D ordenado en forma descendente: "<<endl; for (i=0; i<n*n; i++) cout<<B[i]<<" "; 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