Replace this code:
insert(2,1);
insert(7,2);
insert(8,3);
insert(6,4);
insert(0,4);
insert(3,4);
With a loop which reads the data and insert position from the user using
cin
and than calls
insert
passing those values.
Hint: Your
insert
function will need to do some bounds checking.
But this is your homework, not ours - so writing the code is your task!