Hi Everyone, Im' new in C. I was tasked to do a word game. Its a Guess a word game. The user inputs the letter through arrow keys. Then, my program supposed to check if each letter is correct. Then, display it in boxes. The problem is I cannot validate the letter chosen when it's duplicate. I used the strstr command in searching the letter. Below is the snippet, please help:
substr=strstr(temp,temp1);
if (substr != NULL)
{
if (prevchc != choices[pos1])
{
rightlet=rightlet+1;
gotoxy(1+rightlet,18);
printf(choices[pos1]);
prevchc=choices[pos1];
}
//else
// {
// gotoxy(20,20);
// printf("You already guessed the letter");
}
if (rightlet==strlen(Easya[pos]))
{
gotoxy(1,19);
printf(Easya[pos]);
gotoxy(20,20);
printf(commentsr[pos]);
rightword=rightword+1;
sleep(2);
goto nextquestion;
}
if (tries==5)
{
gotoxy(20,20);
printf("Exceeded the number of tries score is ");
printf("%d",rightword);
tries=0;
sleep(2);
goto newquestion;
}