
June 11th, 2004, 04:36 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Location: A small village called Sandhaven 42 miles north of aberdeen
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
How to remove from a position on a user-defined list
Hi there,
Hope someone can help me.
I've got a program which simulates a lift going up and down, adding and removing passengers from queues as it traverses the floors.
Lift moves up and down - works fine.
Customer details are added to a dynamic queue at each floor - works fine.
When the lift arrives at a floor it should remove passengers if they are due to alight at this floor then take on passengers if any are waiting in the queue, up to a static length of six.
Uptake of passengers - works fine.
However, the removal is a gigantic headache. I've had it almost working but the wrong passenger details are removed.
I've tried two ways - I have a boolean in the lift( a user-defined type) which shows true if the required floor is equal to the lift position.
I tried to loop through the array of customer details in the lift until this is false, but I'm having difficulties with parameters and global variables.
I've also tried dispensing with the boollean and just done an if statement, if the required floor is equal to the lift position, but I can't get this to work either.
|