Browse Source

add more print entries

add parent pointer
remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
b8e361c3ec
  1. 8
      src/inputHandling.c
  2. 1
      src/inputHandling.h

8
src/inputHandling.c

@ -16,9 +16,9 @@ void input() {
fgets(a, STRINGL, stdin); //fgets statt scanf, holt den kompletten String inkl. Whitespace fgets(a, STRINGL, stdin); //fgets statt scanf, holt den kompletten String inkl. Whitespace
deleteWhitespace(); deleteWhitespace();
calc_op temp; calc_op temp;
temp.formel = a;
temp.funktionstyp = readFunction(a, 10); temp.funktionstyp = readFunction(a, 10);
getnumbers(a,STRINGL, &temp); getnumbers(a,STRINGL, &temp);
printf("Ihre Berechnung: %s \n", a);
printstruct(&temp); printstruct(&temp);
} }
@ -78,6 +78,7 @@ void getnumbers(char* data, int length, calc_op* structure_ref){ //input sind: s
} }
void printstruct(calc_op* formula){ void printstruct(calc_op* formula){
printf("Berechnung: %s", formula->formel);
switch (formula->funktionstyp) { switch (formula->funktionstyp) {
case opAdd: case opAdd:
printf("Rechenoperation: Addition\n"); break; printf("Rechenoperation: Addition\n"); break;
@ -90,4 +91,9 @@ void printstruct(calc_op* formula){
default: default:
printf("Fehler bei Auswahl der Rechenoperationen \n"); printf("Fehler bei Auswahl der Rechenoperationen \n");
} }
printf("Calculation Variables:\n");
for (int i = 0; i < formula->arraylength; ++i) {
printf("Array[%i] = %f\n", i, formula->array[i]);
}
printf("Result: %f", formula->result);
} }

1
src/inputHandling.h

@ -11,6 +11,7 @@ char* formel;
double array[10]; double array[10];
int arraylength; int arraylength;
void* child; void* child;
void* parent;
double result; double result;
}calc_op; }calc_op;

Loading…
Cancel
Save