title: C++ switch statement , how does this work
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  
  int main(int argc, char* argv[]) {
  if ( argc != 2 ) {
   std::cout &lt;&lt; "usage: " &lt;&lt; argv[0] &lt;&lt; " &lt;n&gt; " &lt;&lt; std::endl;
   return 0;
  }
  std::stringstream strm;
  strm &lt;&lt; argv[1];
  int count = 0;
  int number;
  strm &gt;&gt; number;
  switch ( number ) {
   case 0: ++count; 
   case 1: ++count; 
   case 2: ++count; 
   case 3: ++count; 
   case 4: ++count; 
   }
  
      std::cout &lt;&lt; "count: " &lt;&lt; count &lt;&lt; std::endl;
      return 0;
   }
  </code></pre>
  
  <p>I know this is a novice question, but i just started with C++. I took a game design course and this is the first example prof has on the SVN.  When I run the prog after compiling, </p>
  
  <p>./run 4
  (i.e. I give argument 4) I get an output: count: 1</p>
  
  <p>./run 3
  I get an output: count: 2</p>
  
  <p>./run 1
  count: 4</p>
  
  <p>./run 0
  count: 5</p>
  
  <p>Since count is initialized to 0, how come ./run 1 gives 4 or ./run 0 give count 5. </p>
  
  <p>I am really sorry for such a silly question, but I would appreciate any explanation.  </p>
  
  <p>Thanks in Advance
  Regards</p>