First off I just want to say that this is a school assignment, so to keep this within the guidelines of this site I am not looking for a premade function or anything. Just some ideas.
This sounds like a simple problem but for some reason but I've never had to deal with it mostly because most of time I would just use std::vector in my projects. Though because this is a school assignment, for this one we are not allowed to use std::vector but must use an array.
Let's say I have an array and I want to delete index 4. I will need to fill in the gaps of the array by shifting all index's above 4 down. I know this is getting in the range of a dynamic array, though in this example their will always be a set number of elements in the array. I just need to move all elements down while the others just won't have anything in them but junk. It is said in the assignment that we can assume the user won't access elements past a certain amount or check for the junk values.
Some of my ideas that maybe some of y'all could help me with to lead me in the right direction.
I was thinking a recursive approach of moving one element at a time until we get to the end of the array.
Next would be a loop until you reach the end of the array (seems it would close to the recursive approach, except looping instead).
These are the two ideas that I thought off. Though I am unsure of the exact way to implement it. Would I need to company every element of the array over to a new one? Or what?
Thanks for any ideas or thoughts over this. If you have any other ideas to present to me I am all ears. Thanks.