You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
845 B

11 months ago
11 months ago
11 months ago
  1. #include "helloWorld.h"
  2. #include "inputHandling.h"
  3. #include "outputHandling.h"
  4. #include <string.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #define STRING_LENGTH 200
  8. char inputBuffer[STRING_LENGTH] = {0};
  9. void main() {
  10. calc_op *result = NULL;
  11. printf("Geben Sie eine Rechenoperation ein (Bsp.: 1+1):\n");
  12. fgets(inputBuffer, STRING_LENGTH, stdin); //fgets statt scanf, holt den kompletten String inkl. Whitespace
  13. processInput(inputBuffer, strlen(inputBuffer));
  14. do {
  15. result = getNextCalc();
  16. if (result == NULL) {
  17. break;
  18. }
  19. if (result->functionsType==opResult) {
  20. result->result = result->inputNumbers[0];
  21. showResult(result);
  22. break;
  23. }
  24. /* Calculation*/
  25. result->result = 65478;
  26. } while (1);
  27. result = getNextCalc();
  28. }