title: C++ rerun program
body: <p>I am trying to get this portion of my C++ program to work so that the program reruns itself when 'y' is entered. When 'n' is entered, "Press any key to continue" needs to pop up.</p>
  
  <p>What I have tried:</p>
  
  <pre><code>int main() {
  
      char again; 
  
         if (again == 'y'){
      // Asks user if they want to play again
         cout &lt;&lt; "Would you like to play again? (y/n):";
         cin &gt;&gt; again;
      } else if (again == 'n'){
        cout &lt;&lt; "Press any key to continue." &lt;&lt; endl;
        cin.ignore(1);
  </code></pre>
  
  <p>Output should look like this when 'n' is entered:
  Would you like to play again? n 
  Press any key to continue . . .</p>
  
  <p>output for 'y' should restart entire program</p>