From 6e7fafed15d6db33113dfd0f8330f89300ea4015 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Thu, 8 Feb 2024 02:26:44 +0100 Subject: [PATCH] function generiereZufallsOperator --- src/main/c/Mathe.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 9ac095a..199374c 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -57,7 +57,12 @@ void initialisiereZufallsgenerator() { int generiereZufallszahl(int min, int max) { return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); } - +//19 +char generiereZufallsOperator() { + char operatoren[] = {'+', '-', '*', '/'}; + int index = rand() % 4; + return operatoren[index]; +}