|
@ -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); |
|
|
} |
|
|
} |