1. ## Little help required...

Hey guys, I got a couple of small little bugs here, for one when my program restarts, it doesn't work properly, and I can't figure out why!
I know the layout is a little messy, I need to try and sort that out, but I was wondering what name I could use for the integer 'z' as 'z' is confusing me!
Any suggestions?

Thanks alot!

Code:
```#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int number,
input,
a=0,
z=50,
fin=0,
restart=0;

printf("Think of a number between -100 and 100...\n\nI will attempt to guess it. To answer the questions you must enter:\n\n1 for Higher\n2 for Lower\n3 for the Correct answer\n");

while(restart==0) /* restarts program automatically after it's found your number */
{
printf("\nThought of that number yet? - Ready when you are!\n\n");
printf("Is your number Higher or Lower than 0? ");
scanf("%d", &input);

if(input==1)
{
number=50;
}
if(input==2)
{
number=-50;
}
if(input==3)
{
}
{
while(fin==a)
/* This while loop is used to run the code to ask the next question
while the game is not over i.e. "fin" is not set to 1 */
{
printf("Is your number Higher, Lower or Correct at %d? ", number);
scanf("%d", &input);

if(z%2==1)

{
z=(z/2)+1;
/* This checks to see if there is a remainder when "z" is
divided by two. 1 is added to the result, if a remainder
is found. If "z" cannot be divided by two without a remainder
it is rounded up */
}
else
{
z=z/2;
}
if(input==1)
{
number=number+z;
/* If you respond that your number is higher (1) then z is added to "number"*/

}
if(input==2)
{
number=number-z;
/* If you respond that your number is lower (2) then z is subtracted
from "number" */

}
if(input==3)
{
fin=1;
/* If you respond 'correct answer'(3) then the integer "number" is displayed
and "fin" is set to 1 which makes it drop out of the while loop */
}
}
}
}
system("PAUSE");
return 0;
}```

2. take all these inside the restart loop.
a=0,
z=50,
fin=0,
restart=0;

3. Originally Posted by qqqqxxxx
take all these inside the restart loop.
a=0,
z=50,
fin=0,
restart=0;

Ahhh... Thanks alot, it now restarts properly!
Do they still have to be declared with their values? Ahh, guess I can see for myself!

Problem 1 solved, but what do you think I should call 'z' - I can't think of a suitable name which sums up it's job...

4. guess?

5. I've changed 'fin' to 'game' and 'a' to 'zero'

but 'z' to 'guess' - 'z' I suppose guess is slightly related, but I dunno.. any other ideas please?

6. attempt?

You should name your variables, not me.