title: Program Terminates unexpectedly C++
body: <p>The goal of the program is to simulate a medical complex with 6 "Doctor Queues". I tried keeping it close enough to the Java version I've completed (must do this in 3 languages). At this point when I run the <code>DequeuePatients</code> and <code>ListPatients</code> method, the program terminates unexpectedly with no errors. I've tried the debugger but eclipse is ignoring all my breakpoints.Why is it terminating?</p>
  
  <p>The ListPatients method is all follows in Driver class: </p>
  
  <pre><code>void ListPatients() {
  
      int x, QueueChoice = 0;
      bool exit = false;``
  
      while (!exit) {
          for (x = 1; x &lt;= MAX; x++) {
              cout &lt;&lt; x &lt;&lt; ": " &lt;&lt; Doctor[x - 1] &lt;&lt; "\n";
          } // end-for
  
          cout &lt;&lt; "Choose a Queue to List From";
          cin &gt;&gt; QueueChoice;
  
          if (OpenFlag[QueueChoice - 1] == true) { //open flag for each queue
          int i = Complex[QueueChoice - 1]-&gt;GetSize();//Global array of queues
          //cout &lt;&lt;i&lt;&lt;endl;
  </code></pre>
  
  <ol>
  <li><p>Terminates in this loop if function is called</p>
  
  <pre><code> for (x = 1; x &lt;= i; x++) {
          Patient This = Complex[QueueChoice-1]-&gt;GetInfo(x); //Program Terminates here
          cout &lt;&lt; x&lt;&lt; ": " &lt;&lt; endl;//This.ID_Number;
             //&lt;&lt;Complex[QueueChoice - 1]-&gt;GetInfo(x + 1).PrintMe()
      } // end-for
  } // end-if
  
  cout &lt;&lt; "Press 1 to List Another Queue, press 2 to exit";
  cin &gt;&gt; x;
  switch (x) {
  case 1:
      break;
  case 2:
      exit = true;
      break;
    }//switch
   } // end-while
  } // List Patients`
  </code></pre></li>
  </ol>
  
  <p>Queue Class GetInfo and toArray():</p>
  
  <pre><code>/*Return Patient info from each Node*/
  Patient Queue::GetInfo(int Pos) {
      Node* ComplexArray= new Node[Length];
       ComplexArray = this-&gt;toArray();
      return ComplexArray[Pos - 1].Info;
  }
  
  // The toArray method
  Node* Queue::toArray() {
      // Copy the information in each node to an array and return the array.
      int x = Length;
      Node ComplexArray[Length] ={} ;
      Node* Current = new Node();
      Current = Rear;`
      for (x = 0; x&lt;Length;x++) {
          ComplexArray[x] = Node();
          ComplexArray[x].Modify(Current);
          Current = Current-&gt;Next;
      }
      return ComplexArray;
  } // End of toArray method
  </code></pre>
  
  <p>Modify Method in Node:</p>
  
  <pre><code> void Node :: Modify(Node* ThisNode)
   {
       Info = ThisNode-&gt;Info;
       Next = ThisNode-&gt;Next;
   }
  </code></pre>