1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
char valid_letter_used (char letter_used[], char letter_entered, int size2)
{
int x,i;
char ok;
for (x=0; x < size2; x++)
{
if(letter_used[x] == letter_entered)
{
i = x;
}
if(letter_used[i] == letter_entered)
ok = 'n';
else
ok = 'y';
}
return(ok);
}
char get_input (char word_player[], char underscore[], char guess[], char letter_used[], int size2, char &letter_entered, int word_size, int guessed, int &lives)
{
char valid, ok;
printf("got3 letter %c\n",letter_entered );
printf("got4 letter %s\n", letter_used);
ok = valid_letter_used(letter_used, letter_entered, size2);
do{
printf("Enter a guess letter: ");
fgets(guess, size2, stdin);
guess [strlen(guess) - 1] = '\0';
letter_entered = guess[0];
letter_entered = tolower(letter_entered);
printf("got5 letter %c\n",letter_entered );
printf("got letter %s\n",guess);
}while(ok != 'y');
valid = validate_input (word_player, underscore, letter_used, letter_entered, word_size, guessed, lives);
return(valid);
}
|