title: Why will my program not re-enter my 2nd while loop? C++
body: <p>All of my commands and alters to the array work individually. However, when i try to return to the menu the screen just starts jittering and will not continue. I am forced to close the program. How do i fix this.</p>
  
  <pre><code>/* Programmer: Joshua Zuber
     Program Desc: This Program will allow the user to select an icon to display around an array message!
     Program Name:  Array Demonstration
     Clean Compile Date: 
  */
  
  #include&lt;iostream&gt;
  #include&lt;string&gt;
  #include&lt;iomanip&gt;
  #include&lt;cstdlib&gt;
  #include&lt;ctime&gt;
  
  using namespace std;
  
  int main()
  {
      // Arrays
      string Masterfile[] = "I want to thank all the C++ students who has helped me this semester. You have inspired me to work harder and to be able to design small C++ programs using a gamming approach. ";
      string Studentfile[]= "";
  
  
      // Variables
      int Icon;
      char again = 'y';
      int i;
      int j;
      int menu = 'y';
      int menu2 = 'n';
      int menu3 = 'n';
      int menu4 = 'n';
      int menu5 = 'n';
      int objEdit;
  
      while (toupper(again) == 'Y') // Start Main Loop
          {
              cout &lt;&lt; "Welcome to Array Demonstration!" &lt;&lt; "\n\n";
              cout &lt;&lt; Masterfile[0] &lt;&lt; "\n\n";
  
              while(toupper(menu) == 'Y' || toupper(menu2) == 'Y' || toupper(menu3) == 'Y' || toupper(menu4) == 'Y' || toupper(menu5) == 'Y' ) // Start Array Menu Loop
                  {
                      cout &lt;&lt; "Please select one of the below options to edit this string!" &lt;&lt; "\n\n";
                      Studentfile[0] = Masterfile[0];
                      cout &lt;&lt; "1. Size" &lt;&lt; "\n\n";
                      cout &lt;&lt; "2. Replace {all of the C++ students} with {My instructer, Professor Penn}" &lt;&lt; "\n\n";
                      cout &lt;&lt; "3. Swap the word {small} with {efficient}" &lt;&lt; "\n\n";
                      cout &lt;&lt; "4. Erase the phrase {using a gamming approach}" &lt;&lt; "\n\n";
                      cout &lt;&lt; "5. View Final Product" &lt;&lt; "\n\n";
                      cin &gt;&gt; objEdit;
  
                      if(objEdit == 1) // Menu Array Size Check
                          {
                              cout &lt;&lt; "The size of the original string is: " &lt;&lt; Masterfile[0].size() &lt;&lt; "\n\n";
                              cout &lt;&lt; "\n\n" &lt;&lt; "Would you like to return to menu? Y/N " &lt;&lt; "\n\n";
                              cin &gt;&gt; menu2 ; 
                              system("cls");
                          }
                      else if(objEdit == 2) // Menu 2nd Option
                          {
                              cout &lt;&lt; "Changing the phrases!" &lt;&lt; "\n\n";
                              Studentfile[0].replace(16,20,"My instructer, Professor Penn"); 
                              cout &lt;&lt; Studentfile[0] &lt;&lt; "\n\n";
                              cout &lt;&lt; "\n\n" &lt;&lt; "Would you like to return to menu? Y/N " &lt;&lt; "\n\n";
                              cin &gt;&gt; menu3; 
                              system("cls");
                          }
                      else if(objEdit == 3) // Menu 3rd Option
                          {
                              cout &lt;&lt; "Changing the phrases!" &lt;&lt; "\n\n";
                              Studentfile[0].replace(131,5,"efficient" ); 
                              cout &lt;&lt; Studentfile[0] &lt;&lt; "\n\n";
                              cout &lt;&lt; "\n\n" &lt;&lt; "Would you like to return to menu? Y/N " &lt;&lt; "\n\n";
                              cin &gt;&gt; menu4; 
                              system("cls");
                          }
                      else if(objEdit == 4) // Menu 3rd Option
                          {
                              cout &lt;&lt; "Changing the phrases!" &lt;&lt; "\n\n";
                              Studentfile[0].erase(150); 
                              cout &lt;&lt; Studentfile[0] &lt;&lt; "\n\n";
                              cout &lt;&lt; "\n\n" &lt;&lt; "Would you like to return to menu? Y/N " &lt;&lt; "\n\n";
                              cin &gt;&gt; menu5; 
                              system("cls");
                          }
                      else if (objEdit &lt;=0 || objEdit &gt;=6) // Menu Failsafe
                          {
                              cout &lt;&lt; "Please Select a Valid Number" &lt;&lt; "\n\n";
                              cout &lt;&lt; "1. Size" &lt;&lt; "\n\n";
                              cout &lt;&lt; "2. Replace {all of the C++ students} with {My instructer, Professor Penn}" &lt;&lt; "\n\n";
                              cout &lt;&lt; "3. Swap the word {small} with {efficient}" &lt;&lt; "\n\n";
                              cout &lt;&lt; "4. Erase the phrase {using a gamming approach}" &lt;&lt; "\n\n";
                              cout &lt;&lt; "5. View Final Product" &lt;&lt; "\n\n";
                              cin &gt;&gt; objEdit;
                          } 
  
                      else if(objEdit == 5 || toupper(menu) == 'N') // Menu 5th Option
                          {
                              cout &lt;&lt; "Please Select one of the following numbers to choose a symbol!" &lt;&lt; "\n\n";
                              cout &lt;&lt; "1. *" &lt;&lt; "\n\n";
                              cout &lt;&lt; "2. ^" &lt;&lt; "\n\n";
                              cout &lt;&lt; "3. #" &lt;&lt; "\n\n";
                              cout &lt;&lt; "4. +" &lt;&lt; "\n\n";
                              cin &gt;&gt; Icon;
                              system("cls");
  
                              if(Icon &lt;= 0, Icon &gt;= 5)  // User Failsafe
                                  {
                                      cout &lt;&lt; "You're Entry Is Not Valid" &lt;&lt; "\n\n";
                                      cout &lt;&lt; "Please Select one of the following numbers to choose a symbol!" &lt;&lt; "\n\n";
                                      cout &lt;&lt; "1. *" &lt;&lt; "\n\n";
                                      cout &lt;&lt; "2. ^" &lt;&lt; "\n\n";
                                      cout &lt;&lt; "3. #" &lt;&lt; "\n\n";
                                      cout &lt;&lt; "4. +" &lt;&lt; "\n\n";
                                      cin &gt;&gt; Icon;
                                      system("cls");
                                  }
                              else // Icon Breakdown
                                  {
  
                                      if(Icon == 1) //  Icon Choice 1
                                          {
                                              for (i=1;i&lt;=1;i++)
                                                  {
                                                      for (j=1;j&lt;=i;j++);
                                                      {
                                                          cout &lt;&lt; "*******************************************************************************" &lt;&lt; "\n";
                                                          cout &lt;&lt; Studentfile[0] &lt;&lt; "\n";
                                                          cout &lt;&lt; "*******************************************************************************" &lt;&lt; "\n";
                                                          cout &lt;&lt; endl;
                                                          cout &lt;&lt; "\n\n" &lt;&lt; "Do you wish to play again? Y/N " &lt;&lt; "\n\n";
                                                          cin &gt;&gt; again; 
                                                          system("cls");
                                                      }
                                                  }
                                          }
  
                                      else if(Icon == 2) // Icon Choice 2
                                          {
                                              for (i=1;i&lt;=1;i++)
                                                  {
                                                      for (j=1;j&lt;=i;j++);
                                                      {
                                                          cout &lt;&lt; "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" &lt;&lt; "\n";
                                                          cout &lt;&lt; Studentfile[0] &lt;&lt; "\n";
                                                          cout &lt;&lt; "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" &lt;&lt; "\n";
                                                          cout &lt;&lt; endl;
                                                          cout &lt;&lt; "\n\n" &lt;&lt; "Do you wish to play again? Y/N " &lt;&lt; "\n\n";
                                                          cin &gt;&gt; again; 
                                                          system("cls");
                                                      }
                                                  }
                                          }
  
                                      else if(Icon == 3) // Icon Choice 3
                                          {
                                              for (i=1;i&lt;=1;i++)
                                                  {
                                                      for (j=1;j&lt;=i;j++);
                                                      {
                                                          cout &lt;&lt; "###############################################################################" &lt;&lt; "\n";
                                                          cout &lt;&lt; Studentfile[0] &lt;&lt; "\n";
                                                          cout &lt;&lt; "###############################################################################" &lt;&lt; "\n";
                                                          cout &lt;&lt; endl;
                                                          cout &lt;&lt; "\n\n" &lt;&lt; "Do you wish to play again? Y/N " &lt;&lt; "\n\n";
                                                          cin &gt;&gt; again; 
                                                          system("cls");
                                                      }
                                                  }
                                          }
                                      else if(Icon == 4) // Icon Choice 4
                                          {
                                              for (i=1;i&lt;=1;i++)
                                                  {
                                                      for (j=1;j&lt;=i;j++);
                                                      {
                                                          cout &lt;&lt; "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" &lt;&lt; "\n";
                                                          cout &lt;&lt; Studentfile[0] &lt;&lt; "\n";
                                                          cout &lt;&lt; "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" &lt;&lt; "\n";
                                                          cout &lt;&lt; endl;
                                                          cout &lt;&lt; "\n\n" &lt;&lt; "Do you wish to play again? Y/N " &lt;&lt; "\n\n";
                                                          cin &gt;&gt; again;
                                                          system("cls");
                                                      }
                                                  }
                                          }
                                      else   //  Icon Choice 5
                                          {
                                              cout &lt;&lt; "Sorry You Didn't Want to Play" &lt;&lt; "\n\n";
                                              cout &lt;&lt; "\n\n" &lt;&lt; "Do you wish to play again? Y/N " &lt;&lt; "\n\n";
                                              cin &gt;&gt; again; 
                                              system("cls");  
                                          }
                                  }
                          }              
                  } // End Menu Loop   
          }   // End Main Loop        
      cout &lt;&lt; "Thank you for playing!" &lt;&lt; "\n\n";
      system("pause");
      return 0;   
  }
  </code></pre>