Quick Stacks and Queues Problem

We have a project where we create a office simulator where the worker can enter and leaver the office. And documents can be submitted to an inbox stack and later sorted into priority queues (one, two, and three). Those documents can also be withdrawn later regardless if they are in stack or queue.

My problem right now is everything works perfect EXCEPT when a document is trying to be withdrawn from the first priority queues it always says it cannot be found.

Here is what i have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void Office::withdraw_document(string name)
{
  if (inbox_stack->withdraw(name)) {
    cout << "Document " << name << " removed from inbox" << endl;
    return;
  }

  if (priority_queue_one->withdraw(name)) {
    cout << "Document " << name << " removed from queue 1" << endl;
    return;
  }

  if (priority_queue_two->withdraw(name)) {
    cout << "Document " << name << " removed from queue 2" << endl;
    return;
  }

  if (priority_queue_three->withdraw(name)) {
    cout << "Document " << name << " removed from queue 3" << endl;
    return;
  }
    cout << "Document " << name << " was not found" << endl;

}


The command that is executed is "Withdraw A". Within the withdraw function i call the remove function for the linked_list where i search through the list iteratively checking the name of each document to see if it matches. If it does, then it gets removed and returns true. If not then it returns false. the withdraw function then returns true of false corresponding to what the remove function returns.

Any help would be appreciated, if you need more code then let me know and i can post it. I just am so frustrated that i can withdraw from every EXCEPT priority_queue_one.
Topic archived. No new replies allowed.