Oct 11, 2014 at 10:25pm UTC
.....................................
Last edited on Oct 12, 2014 at 8:17pm UTC
Oct 11, 2014 at 11:17pm UTC
1 2 3 4
queue<int > pid;
if (input == 'A' ){
pid.push(0);
....
Last edited on Oct 11, 2014 at 11:17pm UTC
Oct 11, 2014 at 11:21pm UTC
..........................................................................
Last edited on Oct 12, 2014 at 8:17pm UTC
Oct 12, 2014 at 12:43am UTC
.....................................................................
Last edited on Oct 12, 2014 at 8:17pm UTC
Oct 12, 2014 at 1:53am UTC
.........................................................................
Last edited on Oct 12, 2014 at 8:18pm UTC
Oct 12, 2014 at 2:01am UTC
Look at the if-statement in my code and look at yours then look at mine and back to yours, what do you see? You see a single `=` sign in yours and notice the `==` in mine. Why does yours not look like mine? I don't know. Now back to yours, change it to look like mine and run your code, what happens now?
Oct 12, 2014 at 2:05am UTC
........................................................................
Last edited on Oct 12, 2014 at 8:18pm UTC
Oct 12, 2014 at 2:07am UTC
Paste your new program here and we will see what the problem is
Oct 12, 2014 at 3:03am UTC
...........................................................................................................
Last edited on Oct 12, 2014 at 8:18pm UTC
Oct 12, 2014 at 5:30am UTC
...............................................................................
Last edited on Oct 12, 2014 at 8:19pm UTC
Oct 12, 2014 at 6:38pm UTC
..........................................................................................
Last edited on Oct 12, 2014 at 8:19pm UTC
Oct 12, 2014 at 7:16pm UTC
This means that you need a stack rather than a queue. A queue will kill the processes in the order they arrived, and a stack will do it in reverse. Also have you tried what JLBorges suggested?
Oct 12, 2014 at 7:37pm UTC
.............................................................................................
Last edited on Oct 12, 2014 at 8:19pm UTC