title: c++ generic solution for alternating for-loop
body: <p>I want something done for every second run of a for-loop. Is there a nice way to do this without using tons of lines?</p>
  
  <p>And while we're at it, I would prefer a generic "trick", so doing something every third or forth time is possible as well?</p>
  
  <p>Example:</p>
  
  <pre><code>for( int i = 0; i &lt; 10; i++ )
  {
     do something;
  
     if( i == odd number )
     {
        do something every alternating time;
     }
  }
  </code></pre>
  
  <p>Hope you can help.
  Cheers.</p>