From be5b6adc0be8309805e37e69a838147936a280cc Mon Sep 17 00:00:00 2001 From: manusmac Date: Sun, 26 Oct 2025 20:35:02 +0100 Subject: [PATCH] main.c fertig angepasst --- Start_Mac/main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Start_Mac/main.c b/Start_Mac/main.c index 03da755..9a98d80 100644 --- a/Start_Mac/main.c +++ b/Start_Mac/main.c @@ -37,10 +37,22 @@ 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 + printf("All %u words were successfully placed in the word salad!\n", wordCount); + createWordSalad(wordSalad, SALAD_SIZE, words, wordCount); + showWordSalad(wordSalad, SALAD_SIZE); + } + else + { + // Error message if some words couldn't be placed + fprintf(stderr, "Error: Only %u out of %u words could be placed in the word salad.\n", + placedWords, wordCount); + exitCode = EXIT_FAILURE; + } } else {