title: C++ Do-while loop stopping
body: <p>I got an assignment where we make a cmd prompt show up and display a flashcard game for multiplication. After inputting a correct answer a prompt shows up and asks the user to go "Again? Y/N." after the second input answer the prompt to ask the user doesn't show up and it's stuck on a "congratulations" message. This happens when I write in code to randomly generate two numbers for the game twice. one outside the  while loop, and one inside while loop. If I leave one out the 2nd code for the random numbers it will run fine but will only display the same numbers over again. what I'm asking is how do I fix it so that it won't get stuck after the second answer input? </p>
  
  <p>sample code below:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int num1, num2, ans, guess, count = 0;
      char choice;
  
      num1 = rand() % 12 + 1;  
      num2 = rand() % 12 + 1;
      //first number generator.
      ans = num1 * num2;
  
      do
      {
          {
              cout &lt;&lt; num1 &lt;&lt; " X " &lt;&lt; num2 &lt;&lt; " = ";
              cin &gt;&gt; guess;
              cout &lt;&lt; "Wow~! Congratulations~! ";
              count++;
  
              num1 = rand() % 12 + 1;
              num2 = rand() % 12 + 1;
              //second number generator.
  
          } while (guess != ans);
  
  
          cout &lt;&lt; "\nAgain? Y/N: ";
          cin &gt;&gt; choice;
  
      } while ((choice == 'y') || (choice == 'Y'));
      //after two turns the loop stops. Can't make a choice.
  
      cout &lt;&lt; " Thanks for playing! Number of tries:" &lt;&lt; count &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>