From 000bc1ebdf5544b3673594ece7392ca0d0d2a193 Mon Sep 17 00:00:00 2001 From: stammjo100588 Date: Fri, 24 Oct 2025 22:09:30 +0200 Subject: [PATCH] Changed Input.c to solve Test 2 & 3 Aswell --- Start_Mac/input.c | 10 +++------- Start_Windows/input.c | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Start_Mac/input.c b/Start_Mac/input.c index 934f9cf..2bffda5 100644 --- a/Start_Mac/input.c +++ b/Start_Mac/input.c @@ -6,20 +6,16 @@ // TODO: // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. - int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { unsigned int count = 0; - // Solange noch Platz ist und Wörter vorhanden sind while (count < maxWordCount && fscanf(file, "%s", words[count]) == 1) { - // Optional: alle Buchstaben in Kleinbuchstaben umwandeln for (int i = 0; words[count][i]; i++) { - words[count][i] = tolower((unsigned char)words[count][i]); + words[count][i] = toupper((unsigned char)words[count][i]); } - count++; } - return count; // gibt zurück, wie viele Wörter tatsächlich eingelesen wurden -} \ No newline at end of file + return count; +} diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 934f9cf..2bffda5 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -6,20 +6,16 @@ // TODO: // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. - int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { unsigned int count = 0; - // Solange noch Platz ist und Wörter vorhanden sind while (count < maxWordCount && fscanf(file, "%s", words[count]) == 1) { - // Optional: alle Buchstaben in Kleinbuchstaben umwandeln for (int i = 0; words[count][i]; i++) { - words[count][i] = tolower((unsigned char)words[count][i]); + words[count][i] = toupper((unsigned char)words[count][i]); } - count++; } - return count; // gibt zurück, wie viele Wörter tatsächlich eingelesen wurden -} \ No newline at end of file + return count; +}