title: How do I break from a while loop with a switch?
body: <p>I'm trying to break from a while loop in a switch statement but it's not working. I get an infinite loop. Why?</p>
  
  <pre><code>int main()
  {
      int n;
      while (std::cin &gt;&gt; n)
      {
           switch (n)
           {
           case 4:
               break;
               break;
           default:
               std::cout &lt;&lt; "Incorrect";
               break;
           }
      }
  }
  </code></pre>