|
@ -81,4 +81,18 @@ char generiereZufallsOperator() { |
|
|
return operatoren[index]; |
|
|
return operatoren[index]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//20 |
|
|
|
|
|
int berechneErgebnis(int zahl1, int zahl2, char operator) { |
|
|
|
|
|
switch (operator) { |
|
|
|
|
|
case '+': |
|
|
|
|
|
return addiere(zahl1, zahl2); |
|
|
|
|
|
case '-': |
|
|
|
|
|
return subtrahiere(zahl1, zahl2); |
|
|
|
|
|
case '*': |
|
|
|
|
|
return multipliziere(zahl1, zahl2); |
|
|
|
|
|
case '/': |
|
|
|
|
|
return dividiere(zahl1, zahl2); |
|
|
|
|
|
default: |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |