Thursday, July 30, 2009

Program in gueue with it function push & top in c++?

pls help ineed this program that consieder the each element in the array as waiting time for people in a queue ,so find the waiting time to the element 12 until it reachs the end of the queue .using the functions of the queue in c++


pls keep it simple ....

Program in gueue with it function push %26amp; top in c++?
You don't need to go all the way down the queue when found the 12th element. You search it by a simple for loop and when found you can exit the loop.


for(int i=0; i%26lt;sizeOfArray; i++){


if(array[i] == valueSearchedFor) exit;// or break


}


int waitingTime=array[i];

kudzu

No comments:

Post a Comment