Mail Archives: djgpp/2001/10/01/15:05:12
> From: "b279" <b279 AT inetone DOT net>
> Newsgroups: comp.os.msdos.djgpp
> Date: Mon, 1 Oct 2001 14:22:57 -0400
>
> Problem 1:
> I have a for loop set up like this.
>
> for (int i=1, i<100, i++)
> my statements;
Wrong syntax. Try this:
for (int i = 1; i < 100; i++)
{
your statements;
}
This will only compile clean as a C++ program, for C programs, you
need to move the declaration of i outside the loop:
int i;
...
for (i = 1; i < 100; i++)
{
your statements;
}
> while(!kbhit())
> my statements;
>
> I would assume it would loop until a key is pressed, but I can push all the
> on the keyboard, but the while loop continues on.
This works for me. Please post a complete short program which
exhibits this behavior.
- Raw text -