for things like while loops and if statements, the code they will execute is either the next (single) statement or code block. by code block, it is a group of statements surrounded by curly braces. in your case, the while loop will do (as with all while loops,) either the next statement or code block after your while loop, which in your code is only a semi colon ";", a single statement. a while loop is different from a regular statement, so remove the semicolon, so that it will execute the code block (stuff surrounded by the curly braces) on each iteration which is what you want.

edit: here is example code to further illustrate what i have described

Code:

// the code that is executed when the while condition is true is either the next single statement or code block,
// which is the "myVariable=someValue;" statement only in this case
while ( myVariable != someValue )
myVariable = someValue;
anotherStatement;

// the code that is executed when the while condition is true is either the next single statement or code block,
// which is the block of statements surrounded by curly braces { and } in this case
while ( myVariable != someValue )
{
myVariable = someValue;
printf(...);
myOtherVar = anotherValue;
}
myVariable++ ;

12-28-2008

NeonBlack

Code:

while (GameEnd != 1);

The syntax for while loops and do loops is

Code:

while(condition){}

and

Code:

do{}while(condition);

Notice the semicolons. I think every new programmer makes this mistake at least once.

edit:
I still have to complain about your indentation.

12-28-2008

bbeltwilson

Quote:

Originally Posted by NeonBlack

Code:

while (GameEnd != 1);

The syntax for while loops and do loops is

Code:

while(condition){}

and

Code:

do{}while(condition);

Notice the semicolons. I think every new programmer makes this mistake at least once.

edit:
I still have to complain about your indentation.

sorry im working on it iv been at this whole programming thing for 2 days.