0

we are in a section were we are working with classes also with arrays my question is if you have an array of students how can you remove that student for the list by copying the other students for below up a slot.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by WaltP
0

When the elements of the array are moved (or copied) up a slot that will overwrite whatever was there before. That does not make the arrray smaller, it just means the last array element is left empty, or unused.

0

thats exactly what i want to do so what would the code look like if i had to search for the student and remove it from the list

Edited by TSaunders84: n/a

0

Think about it, then try to write the problem yourself. Post YOUR code with whatever question(s) you may have. Please deposit $10,000.00USD in my PayPal account and I'll write that for you :)

0

Use 2 indexes, 1 for 'student', 1 for 'new position'. Start them both at 0.
Increment both indices until you find the student you want to remove.
Increment only the student index.
Now continue to the end of the array copying the values in the 'student' index into the positions of the 'new position' index.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.