From 7294f511d55806f640a80bb001eeb1b92bc03d36 Mon Sep 17 00:00:00 2001 From: fdai7731 Date: Wed, 7 Feb 2024 23:14:36 +0100 Subject: [PATCH] Declaration for Random Operator --- src/main/c/Mathe.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/c/Mathe.c b/src/main/c/Mathe.c index 683434b..592c02c 100644 --- a/src/main/c/Mathe.c +++ b/src/main/c/Mathe.c @@ -71,4 +71,14 @@ void initialisiereZufallsgenerator() { //18 int generiereZufallszahl(int min, int max) { - return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); + return min + (int)((double)rand() / (RAND_MAX + 1) * (max - min + 1)); + + +//19 +char generiereZufallsOperator() { + char operatoren[] = {'+', '-', '*', '/'}; + int index = rand() % 4; + return operatoren[index]; + + +