title: Putting a switch inside of do...while
body: <p>So I have a do... while statement that is supposed to repeat unless the user enters one of four things. Those four things have a break and they set the variable that controls the while to true, where the default is false. If the user does not enter one of the four answers, the variable will stay false, which should make the do...while start again. It doesn't.</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int q5_answer = 1;
      int q5_answerU;
      int total_score;
      bool q5_valid = false;
  
      //Question_5:
      do
      {
          cout &lt;&lt; "Question 5 (#1 is correct)" &lt;&lt;endl;
          cout &lt;&lt; "1.) Answer 1" &lt;&lt;endl;
          cout &lt;&lt; "2.) Answer 2" &lt;&lt;endl;
          cout &lt;&lt; "3.) Answer 3" &lt;&lt;endl;
          cout &lt;&lt; "4.) Answer 4" &lt;&lt;endl;
          cin &gt;&gt; q5_answerU;
  
          switch (q5_answerU)
          {
          case 1:
              cout &lt;&lt; "Correct!" &lt;&lt;endl;
              q5_valid = true;
              (total_score = total_score + 1);
              break;
          case 2:
              cout &lt;&lt; "Incorrect" &lt;&lt;endl;
              q5_valid = true;
              break;
          case 3:
              cout &lt;&lt; "Incorrect" &lt;&lt;endl;
              q5_valid = true;
              break;
          case 4:
              cout &lt;&lt; "Incorrect" &lt;&lt;endl;
              q5_valid = true;
              break;
          default:
              cout &lt;&lt; "Invalid answer" &lt;&lt;endl;
          }
      } while (q5_valid = false);
  }
  </code></pre>