123456789101112131415161718192021222324252627
void countOff (LinkedQueue<string> officers, int count) { //Write method here int hatNumber = count; int num = 1; string lastMan; string tempOfficer; while(!officers.isEmpty()) { if(num != hatNumber) { tempOfficer = officers.peekFront(); officers.dequeue(); officers.enqueue(tempOfficer); num++; } else { lastMan = officers.peekFront(); officers.dequeue(); num = 1; cout << "The officers removed from the queue are: " << lastMan << endl; } }//end while cout << "The officer going for help is: " << lastMan << endl; }//end countOff()