Browse Source

refactoring: Umbenennen der formalen Parameter von letterGuessedzu verständlicheren Namen

remotes/origin/tim
fdai7727 11 months ago
parent
commit
c086500f89
  1. 10
      src/main/c/Tim/hangman.c

10
src/main/c/Tim/hangman.c

@ -162,20 +162,20 @@ bool wordGuessed(char guessWord[], char displayWord[])
}
}
bool letterGuessed(char x, char y[], int length)
bool letterGuessed(char selectedLetter, char guessWord[], int length)
{
int counter = 0;
for(int i = 0; i<length; i++) {
if(isupper(x)!=0)
if(isupper(selectedLetter) != 0)
{
if (x == y[i]-32 || x == y[i] )
if (selectedLetter == guessWord[i] - 32 || selectedLetter == guessWord[i] )
{
counter++;
}
}
else
{
if (x == y[i]||x == y[i]+32)
if (selectedLetter == guessWord[i] || selectedLetter == guessWord[i] + 32)
{
counter++;
}
@ -184,7 +184,7 @@ bool letterGuessed(char x, char y[], int length)
}
if(counter>0)
{
printf("Dein gewaehlter Buchstabe %c war ein Treffer!\n", x);
printf("Dein gewaehlter Buchstabe %c war ein Treffer!\n", selectedLetter);
return true;
}
else

Loading…
Cancel
Save