C++ queues, output error
<p>I have a project with priority queues and reqular queues. 
I need to organize products by IDs from min to max using priority queues. </p>

<p>And then using reqular queues I need to put them into 3 categories: 
(over-stock, under-stock, within limits); so the output should look like this:</p>

<p>UnderStock</p>

<p>14887 $10 14 </p>

<p>15678 $1 298 </p>

<p>OverStock</p>

<p>12565 $4 539 </p>

<p>18967 $12 401</p>

<p>StockWithinLimits</p>

<p>19847 $2 220</p>

<p>I wrote this code, but something is off that I am not sure and my out put looks like: </p>

<p>OverStock</p>

<p>12565 $4 539</p>

<p>UnderStock</p>

<p>14887 $10 14</p>

<p>UnderStock</p>

<p>15678 $1 298</p>

<p>OverStock</p>

<p>18967 $12 401</p>

<p>StockWithInLimits</p>

<p>19847 $2 220</p>

<pre class="lang-cpp prettyprint-override"><code>int main() 
{ 
    ifstream inFile; // file containing operations 
    ofstream outFile; // file containing output 
    string inFileName = "product.txt"; 
    string outFileName = "result.txt"; 
    inFile.open (inFileName.c_str()); 
    outFile.open (outFileName.c_str()); 
    ItemType item;//declare a temp item that trows into pQue 
    PQType&lt;ItemType&gt; pqueue(50);//priority queue that sorts items by ID 
    QueueADT &lt;ItemType&gt; que; 
    QueueADT &lt;ItemType&gt; lowQ;
    QueueADT &lt;ItemType&gt; highQ;
    QueueADT &lt;ItemType&gt; withinQ;

    while ( item.readProduct (inFile) ) 
    { 
        pqueue.Enqueue(item); 

    } 

    while (!pqueue.IsEmpty()) 
    { 
        pqueue.Dequeue (item); 
        int tempcurinvent = item.getcurrentInventory (); 
        int tempmax = item.getMax (); 
        int tempmin =item.getMin (); 

    if ((tempcurinvent &lt; tempmin) &amp;&amp; (tempcurinvent &lt; tempmax))//UnderStock 
        {
            lowQ.Enqueue (item);
        }

if ((tempcurinvent &lt; tempmax) &amp;&amp; ( tempcurinvent  &gt; tempmin)) //WithINLimits
        { 
            withinQ.Enqueue (item);
        } 
else if ((tempcurinvent &gt; tempmin) &amp;&amp; (tempcurinvent &gt; tempmax))//OverStock 
        { 
            highQ.Enqueue (item);
        }
        outFile &lt;&lt; "UnderStock" &lt;&lt; endl;
        item.printProduct (outFile);
        lowQ.Dequeue (item);

        outFile &lt;&lt; "WithINLimits:" &lt;&lt; endl;
        item.printProduct (outFile); 
        withinQ.Dequeue (item);

        outFile &lt;&lt; "OverStock" &lt;&lt; endl; 
        item.printProduct (outFile); 
        highQ.Dequeue (item);

    }

    inFile.close (); 
    outFile.close (); 



  return 0; 
} 
</code></pre>
