[Solved] C++ How can I delete -1 from my vector?
You’re accessing outside the vector. When you get to the last iteration of the for loop in bubbleSort(), numbers[i] is the last element of the vector, and numbers[i+1] is outside. This results in undefined behavior, and in your case it happens to access the -1 that you initially put in the vector and then popped … Read more