|
@ -4,6 +4,7 @@ |
|
|
#include <stdlib.h> |
|
|
#include <stdlib.h> |
|
|
#include <time.h> |
|
|
#include <time.h> |
|
|
#include <stdbool.h> |
|
|
#include <stdbool.h> |
|
|
|
|
|
#include <ctype.h> |
|
|
|
|
|
|
|
|
#define LISTSIZE 10 |
|
|
#define LISTSIZE 10 |
|
|
#define MAX_WORD_LENGTH 30 |
|
|
#define MAX_WORD_LENGTH 30 |
|
@ -90,11 +91,38 @@ bool letterGuessed(char x, char y[], int length, char ptr[]) |
|
|
{ |
|
|
{ |
|
|
int counter = 0; |
|
|
int counter = 0; |
|
|
for(int i = 0; i<length; i++) { |
|
|
for(int i = 0; i<length; i++) { |
|
|
if (x == y[i]) { |
|
|
|
|
|
ptr[i] = x; |
|
|
|
|
|
printf("Dein gewählter Buchstabe %c war ein Treffer!\n", x); |
|
|
|
|
|
counter++; |
|
|
|
|
|
|
|
|
if(isupper(x)!=0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (x == y[i]-32 || x == y[i] ) |
|
|
|
|
|
{ |
|
|
|
|
|
if(i ==0) |
|
|
|
|
|
{ |
|
|
|
|
|
ptr[i] = x; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
ptr[i] = x+32; |
|
|
|
|
|
} |
|
|
|
|
|
printf("Dein gewaehlter Buchstabe %c war ein Treffer!\n", x); |
|
|
|
|
|
counter++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
if (x == y[i]||x == y[i]+32) |
|
|
|
|
|
{ |
|
|
|
|
|
if(i == 0) |
|
|
|
|
|
{ |
|
|
|
|
|
ptr[i] = x-32; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
ptr[i] = x; |
|
|
|
|
|
} |
|
|
|
|
|
printf("Dein gewaehlter Buchstabe %c war ein Treffer!\n", x); |
|
|
|
|
|
counter++; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if(counter>0) |
|
|
if(counter>0) |
|
|
{ |
|
|
{ |
|
|