Loops

Hi, I am trying to write a loop but only have my variable increment every other time through the loop. I know to have it increment every time it would be something like for(x=2; x<10; x++) but I am at a complete loss for how to only increment it every other time.
Well, you could have for( int x = 2, t = 1; x<10; t = 1-t, x+=t )...,

or for( int y = 4, x = 2; x < 10; y++, x = y/2 ) ...,

or for( int x = 2; x < 10; x++ ) for( int i = 0; i < 2; i++) ...
Topic archived. No new replies allowed.