SeeTheLite 20 Junior Poster

Oh good god, I don't even know where to begin:
-why do you need a goto statement? a loop would do just fine
-you are closing a nonexistent brackets
-42 is not the random number you generated
-and you also have improper brackets
-don't forget srand(time(0));

anyways, a simplified code would be like

int main() {
int guess,ans,try;
bool game = false;
try=0
char ag;

while(!game) {
if(try == 0)
ans = rand()%100+1;

cout<<"guess a number";
cin>>guess;

if(ans == guess) {
cout<<"you win! try again?y/n";
cin<<ag;

if(ag == 'y')
try=0;

else
game=true;
}
else
cout<<"wrong answer, try again"

if(tries==4)
game=true;

try++;
}

system("PAUSE");
return 0;
}

this wont tell if the answer is too high or too low, but I'll leave that to you. Good luck.

JameB commented: Good job! +1
VernonDozier commented: Good advice. +21
SeeTheLite 20 Junior Poster

Wish by Nine Inch Nails