Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Aufgabe_226_Rechner.cpp
- Revision:
- 3:3860f0e1acf4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Aufgabe_226_Rechner.cpp Tue Apr 21 18:01:10 2020 +0000 @@ -0,0 +1,64 @@ +/****************************************************************************** + +C++ Kurs BULME 19/20 SM +Aufgabe 226 +Rechner(nicht komplett) +Mario Neubauer + +*******************************************************************************/ +#include <stdio.h> +#include <iostream> +using namespace std; + +float addition(float zahl1, float zahl2); + +float subtraktion(float zahl1, float zahl2); + +float multiplikation(float zahl1, float zahl2); + +float division(float zahl1, float zahl2); + +int main() +{ + float zahl1 = 0; + float zahl2 = 0; + float ergebnis = 0; + char Vorzeichen; + + cout << "Eingabe: "; + cin >> zahl1 >> Vorzeichen >> zahl2; + + switch(Vorzeichen){ + case '+': cout<<"Das Ergebnis lautet:" << addition(zahl1,zahl2); break; + case '-': cout<<"Das Ergebnis lautet:" << subtraktion(zahl1,zahl2); break; + case '*': cout<<"Das Ergebnis lautet:" << multiplikation(zahl1,zahl2); break; + case '/': cout<<"Das Ergebnis lautet:" << division(zahl1,zahl2); break; + default : cout << "Falsche Eingabe \n"; return 1; + } + + return 0; + +} +float addition(float zahl1, float zahl2) +{ + float ergebnis = zahl1+zahl2; + return ergebnis; +} + +float subtraktion(float zahl1, float zahl2) +{ + float ergebnis = zahl1-zahl2; + return ergebnis; +} + +float multiplikation(float zahl1, float zahl2) +{ + float ergebnis = zahl1*zahl2; + return ergebnis; +} + +float division(float zahl1, float zahl2) +{ + float ergebnis = zahl1/zahl2; + return ergebnis; +} \ No newline at end of file