// 1a.cpp
#include <iostream>
#include <iomanip>
using namespace std;
void mostrar(int* p, int n);
int main() {
int capacidad = 0, *notas = nullptr;
srand(time(nullptr));
cout<<"Capacidad del arreglo de notas: ";
cin>>capacidad;
notas = new int[capacidad]; // asignando espacio para el arreglo de notas
notas[0] = rand()%21;
mostrar(notas, 1);
for(int j=1; j<capacidad; ++j){
int elemento_a_insertar = rand()%21;
int k = j-1;
while(k>=0 && elemento_a_insertar>notas[k]) {
notas[k+1] = notas[k];
--k;
}
notas[k+1] = elemento_a_insertar;
mostrar(notas,j+1);
}
delete[] notas; // liberando espacio asignado para el arreglo
}
void mostrar(int* p, int n) {
for(int j=0; j<n; ++j) {
cout<<setw(4)<<p[j];
}
cout<<endl;
}