From 9ba7c9589cd8f9f553c827fa7e7f8d5f64b2c2e5 Mon Sep 17 00:00:00 2001 From: fdai7754 Date: Sun, 4 Feb 2024 17:08:24 +0100 Subject: [PATCH] magiceightball funktion implimentiert --- src/magiceightball.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/magiceightball.c b/src/magiceightball.c index e69de29..e8fc495 100644 --- a/src/magiceightball.c +++ b/src/magiceightball.c @@ -0,0 +1,27 @@ +#include +#include +#include + +int run_magiceightball() { + + srand(time(NULL)); + + char antwort[6][100] = { + "Ja", + "Nein", + "Vielleicht", + "Zweifelsfrei", + "Bitte nicht", + "Das trifft zu", + }; + + printf("Frage: "); + + char fragesatz[100]; + fgets(fragesatz, sizeof(fragesatz), stdin); + + int randomIndex = rand() % 6; + printf("%s\n", antwort[randomIndex]); + + return 0; +} \ No newline at end of file