Hey Yall, I'm back again. I just can't seem to get this method to work. I really can't figure out a way to decrease the capacity of myArray. I am supposed to change the capacity of this vector to capacity. If the new capacity is smaller than the current size, remove items from the end of this
vector until the size and new capacity are equal.
Here is my main arg calling this method:
And here is my setCapacity method that I have come up with so far:
As you can see I have remarked out a few of my
test SOP statements. The loop works and temp stops at capacity 4 and 9 for both int capacity cast in. I am certain that there is something stupid that I am missing or there may be an even better way to accomplish this. I'm open for suggestions.
The output is supposed to look like this:
v[1] = < 2, 3, 4, 5 > (cap: 4)
v[2] = < 3, 2, 1, 0, 1, 2, 3 > (cap: 9)
but it still looks like this:
v[1] = < 2, 3, 4, 5, 6, 7 > (cap: 16)
v[2] = < null, 2, 1, 0, 1, 2, 3 > (cap: 10)
Thanks in advance, and thanks for ALL of your help with everything.
Steve