From a85c4bf4d59bc5c55c2114a510b457515970cf61 Mon Sep 17 00:00:00 2001 From: Ronja Awe Date: Fri, 27 Jan 2023 12:51:04 +0100 Subject: [PATCH] =?UTF-8?q?variable=20und=20if=20schleife=20mit=20=20bool?= =?UTF-8?q?=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/raetselronja.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/c/raetselronja.c b/src/c/raetselronja.c index 3e4f91e..bfc0f2a 100644 --- a/src/c/raetselronja.c +++ b/src/c/raetselronja.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "raetselronja.h" #include "userinput.h" @@ -90,12 +91,16 @@ int differenz = 0; int blackjack(int spieler, int gegner, int janein){ int lower = 1, upper = 11, count = 1, num = 0, ergebnis = 0; + bool wiederholen = false; srand(time(NULL)); - printf("Do you want to start the game?\nYES(1), NO(2)\n"); + if (wiederholen = false){ + printf("Do you want to start the game?\nYES(1), NO(2)\n"); + } janein = userInput(); - + + while (spieler < 21 && gegner < 21) { if (janein == 1) { @@ -170,6 +175,7 @@ int blackjack(int spieler, int gegner, int janein){ } } if (ergebnis = 0){ + wiederholen = true; return blackjack(spieler, gegner, janein); }