From 53f5b6af7ed38c859ded6df23bbafa81e5c8d1ca Mon Sep 17 00:00:00 2001 From: Sophia Weber Date: Sat, 27 Jan 2024 15:35:23 +0100 Subject: [PATCH] Created Function to find calculation function type --- src/inputHandling.c | 16 +++++++++++++++- src/inputHandling.h | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/inputHandling.c b/src/inputHandling.c index 8388c59..9c22b86 100644 --- a/src/inputHandling.c +++ b/src/inputHandling.c @@ -4,11 +4,13 @@ char a[STRINGL]; void deleteWhitespace(); +op readFunction(char* data, int length); void input() { printf("Geben Sie eine Rechenoperation ein (Bsp.: 1+1):\n"); fgets(a, STRINGL, stdin); //fgets statt scanf, holt den kompletten String inkl. Whitespace deleteWhitespace(); + op b = readFunction(a, 10); printf("Ihre Berechnung: %s \n", a); } @@ -23,4 +25,16 @@ void deleteWhitespace(){ } } - +//Einfachste Rechenoperationen lesen +op readFunction(char* data, int length){ + for(int i=0; i