In programming often times you will have to do something on every OTHER increment. A nifty trick I picked up that makes that idea very easy.

Code:
for(int i=0;i<10;i++)
  if (i%2 == 0)
    //do something
  else
    //do something else
Another thing that I've seen people do to solve this problem is

Code:
int a = 1;

for(int i=0; i<10;i++)
{
   if(a == 1)
      //do something
   else
     //do something else
   
   a *= -1;
}
Last thing I've noticed and I already made a post about this is the following problem on BCC and g++. Don't know what other compilers are affected but I know VC++ does it correctly (ironic).

Code:
void main() {

  int *arr = new int[10];

  arr[5] = 3;

  cout << "Before: " << arr[5] << endl;//prints out 3
  delete[] arr; //deletes the array from memory
  cout << "After: " << arr[5] << endl; //prints out 3
I was under the impression that delete works pretty much instantaneously and that is what the benefits of using dyanamic arrays were for, to save memory. If it didn't work instantaneously then it would more than likely return the memory at the END of the program which would mean that it takes up memory as much as static arrays. Obviously I could be wrong about this but, that was the impression I got from reading about it. Also I'm getting too used to Java's garbage collecting feature in the compiler which handles that stuff for you =)