toupper funktion in input und enum in game
This commit is contained in:
parent
acb4154bec
commit
3e0fe5f977
@ -23,14 +23,15 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
||||
const int anzahlBuchstaben = 26;
|
||||
|
||||
for (int i = 0; i < wordCount; i++) {
|
||||
int vertikal_horizontal = rand() % 2; //1 = vertikal //0 = horizontal
|
||||
typedef enum {VERTIKAL, HORIZONTAL} Richtung;
|
||||
Richtung vertikal_horizontal = rand() % 2; //1 = vertikal //0 = horizontal
|
||||
int leange = strlen(words[i]);
|
||||
int positionX = 0;
|
||||
int positionY = 0;
|
||||
int voll = 0;
|
||||
int tries = 0;
|
||||
|
||||
if (vertikal_horizontal == 1) {
|
||||
if (vertikal_horizontal == VERTIKAL) {
|
||||
|
||||
tries = 0;
|
||||
do {
|
||||
@ -52,7 +53,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
||||
} else if (voll == 1)
|
||||
printf("Das Wort '%s' konnte nicht plaziert werden", words[i]);
|
||||
|
||||
} else if (vertikal_horizontal == 0) {
|
||||
} else if (vertikal_horizontal == HORIZONTAL) {
|
||||
|
||||
tries = 0;
|
||||
do {
|
||||
|
||||
BIN
Start_Mac/game.o
BIN
Start_Mac/game.o
Binary file not shown.
@ -32,7 +32,10 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
}
|
||||
|
||||
//hier müsste man den token string in großbuchstaben formatieren
|
||||
|
||||
for (int i = 0; i < strlen(token); i++)
|
||||
{
|
||||
token[i] = toupper(token[i]);
|
||||
}
|
||||
strncpy(words[count], token, MAX_WORD_LEN-1);
|
||||
words[count][MAX_WORD_LEN-1] = '\0';
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user