Original Post
I looked in an older programming book and in this book while loops where explained by cookies. So i came up with this little programming game. (Maybe there was a cookie game before, i dunno) Target: The code below has to become long and somehow mad. You can add or change anything you want:
// definitions
#define COOKIEBOX_SIZE 10 //There are 10 cookies in the box
// includes
#include <stdio.h>
// globals
int cookienum=0;
// functions
int Take_Cookie(void)
{
cookienum++;
}
int Box_Is_Empty(void)
{
if(cookienum > COOKIEBOX_SIZE)
return 0;
return 1;
}
int main(void)
{
while(1)
{
Take_Cookie();
if(Box_Is_Empty())
break;
}
return 0;
}