Hey so for school I have create a random number guessing. I'm currently have problems getting it to loop back to the beginning of the program if they press y or n.
Fixed my code. Its in code tags now and I was
trying to do number 3 and failed as you saw.
As of now I'm not aware of any other pausing code.
I'm looking for it now as I type,
but I appreciate your helping a complete novice.
@Azagaros
Didnt notice that post.
It helped me make my code shorter and easier to understand,
but still have the same problems.
I appreciate you pointing that out to me a complete novice.
include <stdio.h>
main()
{
int target;
int guess;
int again;
printf("\n Do you want to guess a number 1 =Yes, 0=No ");
scanf("%d",&again);
while (again)
{
target = rand() % 100;
guess = target + l;
while(target!=guess)
{
printf("\n What is your guess ? ");
scanf("%d",&guess);
if (target>guess) printf("Too low");
else printf("Too high");
}
printf("\n Well done you got it! \n");
printf("\nDo you want to guess a number 1=Yes, 0=No");
scanf("%d",&again);
}
}
return 1;