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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment