title: Trying to print a Queue as Array
body: <p>I am trying to print the contents of a queue as an array. I have the code working and compiling.  The problem is when I call the function more than once the print function does not call and the array is not printed again. I need to print the array more than once and it does not print.</p>
  
  <p>The code for the Print function is :</p>
  
  <pre><code>template &lt;class Type&gt;
   void queueType&lt;Type&gt;::debugArray() 
   {
     for(queueFront; queueFront&lt;count; queueFront++){
      cout &lt;&lt; "[" &lt;&lt; queueFront&lt;&lt; "] ," &lt;&lt; list[queueFront] &lt;&lt; " ";
     }
  
   } //end debugQueue
  </code></pre>
  
  <p>The main.cpp code is: </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "queueAsArray.h"
  
  using namespace std;
  
  int main()
  {
      queueType&lt;int&gt; q1;
      queueType&lt;int&gt; q2;
      queueType&lt;int&gt; q3;
      int x = 5;
  
      for(int i= 0; i&lt;10; i++) {
          q1.addQueue(i);
      }
  
      cout &lt;&lt; "q1 after being filled up with 10 items" &lt;&lt; endl;
  
      q1.printQueueInfo();
  
      cout &lt;&lt; "Queue contents from front to rear\n\n" &lt;&lt; endl;
  
      q1.debugArray();
      q1.deleteQueue();
      q1.deleteQueue();
      q1.deleteQueue();
  
      for(int i= 0; i&lt;=20; i){
          i+=5;
          q1.addQueue(i);
      }
  
      q1.debugArray();
      return 0;
  }
  </code></pre>
  
  <p><strong>Is there a reason why the function call will not print again</strong>?  If you need the entire class and implementation file I can supply it. The weird thing is if I create a second instatiation of the class <code>q2</code>, then build an array for <code>q2</code>, the <code>debugQueue</code> function prints that queue. I then call the overloaded assignment operator and do <code>q2=q1</code>, then call <code>debugQueue</code> Again and it prints the contents of the queue.  So I am confused as why it will print the second queue twice, but not the first queue.
  Any thoughts?</p>