diff --git a/src/inputHandling.c b/src/inputHandling.c index 06974a3..c8191f1 100644 --- a/src/inputHandling.c +++ b/src/inputHandling.c @@ -85,7 +85,7 @@ char* getNumbers(char* formulaString, int length, calc_op* formulaRef){ //proces } void showStruct(calc_op* formulaRef){ - printf("Berechnung: %s\n", formulaRef->formular); + printf("\nBerechnung: %s\n", formulaRef->formular); switch (formulaRef->functionsType) { case opAdd: printf("Rechenoperation: Addition\n"); break; @@ -102,5 +102,5 @@ void showStruct(calc_op* formulaRef){ for (int arrayCount = 0; arrayCount < formulaRef->arrayLength; ++arrayCount) { printf("Array[%i] = %f\n", arrayCount, formulaRef->inputNumbers[arrayCount]); } - printf("Result: %f", formulaRef->result); + printf("Result: %f\n", formulaRef->result); } \ No newline at end of file diff --git a/src/main.c b/src/main.c index a496f5e..9c7787d 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,6 @@ #include "helloWorld.h" #include "inputHandling.h" +#include "outputHandling.h" #include #include #include @@ -8,7 +9,9 @@ char inputBuffer[STRING_LENGTH] = {0}; void main() { + calc_op result; printf("Geben Sie eine Rechenoperation ein (Bsp.: 1+1):\n"); fgets(inputBuffer, STRING_LENGTH, stdin); //fgets statt scanf, holt den kompletten String inkl. Whitespace processInput(inputBuffer, strlen(inputBuffer)); + printResult(&result); } diff --git a/src/outputHandling.c b/src/outputHandling.c new file mode 100644 index 0000000..b38a651 --- /dev/null +++ b/src/outputHandling.c @@ -0,0 +1,8 @@ +#include +#include "outputHandling.h" +#include "inputHandling.h" + + +void printResult(calc_op* result) { + printf("Das Ergebnis ist: %f", result->result); +} \ No newline at end of file diff --git a/src/outputHandling.h b/src/outputHandling.h new file mode 100644 index 0000000..4917a54 --- /dev/null +++ b/src/outputHandling.h @@ -0,0 +1,8 @@ +#ifndef OUTPUTHANDLING_H +#define OUTPUTHANDLING_H + +#include "inputHandling.h" + +extern void printResult(calc_op* result); + +#endif // OUTPUTHANDLING_H diff --git a/test/test_outputHandling.c b/test/test_outputHandling.c new file mode 100644 index 0000000..8735cd7 --- /dev/null +++ b/test/test_outputHandling.c @@ -0,0 +1,20 @@ +#ifdef TEST + +#include "unity.h" + +#include "outputHandling.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_outputHandling_NeedToImplement(void) +{ + TEST_IGNORE_MESSAGE("Need to Implement outputHandling"); +} + +#endif // TEST