From 783bb755e912bda4fd5801a620cc801269955e7f Mon Sep 17 00:00:00 2001 From: Baeuml Date: Wed, 28 Oct 2026 00:02:26 +0100 Subject: [PATCH] TODO in main.c implementiert --- Startcode/main.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Startcode/main.c b/Startcode/main.c index caaaee5..18105ac 100644 --- a/Startcode/main.c +++ b/Startcode/main.c @@ -10,7 +10,7 @@ int main(int argc, char *argv[]) { int exitCode = EXIT_SUCCESS; - //a + // Check if the correct number of arguments is provided if(argc != 2) { @@ -37,9 +37,19 @@ int main(int argc, char *argv[]) placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); // TODO: + // Check if all words were successfully placed - // Start the game if successful - // error message if some words couldn't be placed + if (placedWords == wordCount) + { + // Start the game if successful + startGame(wordSalad, SALAD_SIZE, words, wordCount, 800); + } + else + { + // error message if some words couldn't be placed + fprintf(stderr, "Error: Only %u of %u words could be placed.\n", placedWords, wordCount); + exitCode = EXIT_FAILURE; + } } else