Hehe, another one. I wanted to be able to loop backwards too. So just so I knew I had got it..
//------------------------------------------------------------------------------
// This program will do some simple "for next" loops.
// And then wait for a user to click the window at the end to close.
// Lame code by Shockwave. Heh!
//------------------------------------------------------------------------------
#include <Windows.h>
#include <stdio.h>
//------------------------------------------------------------------------------
// Every program must have a Main()!
//------------------------------------------------------------------------------
int main()
{
//--------------------------------------------------------------------
// The "for next" loop! Counting forwards!
//--------------------------------------------------------------------
{
int a;
for (a = 0 ; a < 10; a++ )
printf( "This should loop 10 times... Counting up!!%u\n",(unsigned int)a);
}
MessageBox (0, "Now we will loop backwards.\nOutput is shown in the console window." ,"That's the first bit!", 0);
//--------------------------------------------------------------------
// The "for next" loop! Counting backwards!
//--------------------------------------------------------------------
{
int a;
for (a = 10 ; a > 0; a-- )
printf( "This should loop 10 times... Counting Down!!%u\n",(unsigned int)a);
}
MessageBox (0, "The Program Has ended.\nOutput is shown in the console window." ,"This Program Has Finished.", 0);
//--------------------------------------------------------------------
// Not really needed but to be complient, we should return 0 when we end.
//---------------------------------------------------------------------
return 0;
}