From bc2395c19fd884f27a844dd4d34f2dd29cd54bac Mon Sep 17 00:00:00 2001 From: Christian Reum Date: Mon, 5 Feb 2024 20:39:26 +0100 Subject: [PATCH] =?UTF-8?q?functional=2014:=20Auslagerung=20int=20f=C3=BCr?= =?UTF-8?q?=20Frage=20crandomNumber()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/wwm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wwm.c b/src/wwm.c index eb70582..c8f8e77 100644 --- a/src/wwm.c +++ b/src/wwm.c @@ -15,6 +15,15 @@ int setGeld(int runde){ } +int crandomNumber() { + srand(time(NULL)); + frage = rand() % 10; + return frage; + +} + + + void wwm(){ printf("Welcome to ´Who wants to be a millionaire?´ \n"); @@ -60,7 +69,7 @@ void wwm(){ printf("__________________________________________________ \n\n"); printf("You are at stage %d and have %d $\n", runde, geld); srand(time(0)); - int frage = rand() % 10; + crandomNumber(); printf("Question %d: %s\n", runde + 1, question[frage]); for (int i = 0; i < 4; i++) {