online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
// 1.cpp #include <iostream> #include <iomanip> using namespace std; void adivinar(int* arr, int cap, int nota); void generar_notas(int** arr, int cap); void ordenamiento_rapido(int* arr, int i_ini, int i_fin); int separar(int* arr, int i_ini, int i_fin); void mostrar(int* arr, int cap); int main() { int n = 0, //numero de notas *p = nullptr, //puntero a entero -para asignar memoria nota = 0; srand(time(nullptr)); cout << "n\t:\t"; cin >> n; generar_notas(&p, n); // asignando memoria nota = p[rand()%n]; // Se escoge la nota a adivinar ordenamiento_rapido(p, 0, n-1); adivinar(p, n, nota); cout << "Notas ordenadas\t\t:\t"; mostrar(p, n); delete[] p; // liberando memoria } void adivinar(int* arr, int cap, int nota) { int elemento_a_buscar = 0; while (true) { cout << "Adivine la nota seleccionada\t:\t"; cin >> elemento_a_buscar; if (elemento_a_buscar == nota) { cout << "Adivinaste!\n"; break; } else if (elemento_a_buscar < nota) cout << "La nota seleccionada es mayor.\n"; else cout << "La nota seleccionada es menor.\n"; } } void generar_notas(int** arr, int cap) { *arr = new int[cap]; for (int j = 0; j < cap; ++j) { (*arr)[j] = rand()%21; } } void ordenamiento_rapido(int* arr, int i_ini, int i_fin) { if (i_ini < i_fin) { int i_pivote = separar(arr, i_ini, i_fin); ordenamiento_rapido(arr, i_ini, i_pivote - 1); ordenamiento_rapido(arr, i_pivote + 1, i_fin); } } int separar(int* arr, int i_ini, int i_fin) { int pivote = arr[i_fin]; int i_aux = i_ini; int aux;//variable auxiliar para hacer los intercambios for (int j = i_ini; j < i_fin; ++j) { if (arr[j] < pivote) { aux = arr[i_aux]; arr[i_aux] = arr[j]; arr[j] = aux; ++i_aux; } } aux = arr[i_aux]; arr[i_aux] = arr[i_fin]; arr[i_fin] = aux; return i_aux;//retornando el indice del pivote } void mostrar(int* arr, int cap) { for (int j = 0; j < cap; ++j) cout << setw(4) << arr[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