Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void rechnen(int art, int x, int y) {
- switch(art) {
- case 1:
- cout << "Das Ergebniss ist: " << x+y << endl;
- break;
- case 2:
- cout << "Das Ergebniss ist: " << x-y << endl;
- break;
- case 3:
- cout << "Das Ergebniss ist: " << x*y << endl;
- break;
- case 4:
- cout << "Das Ergebniss ist: " << x/y << endl;
- break;
- default:
- cout << "Falsche Eingabe." << endl;
- break;
- }
- }
- int main() {
- cout << "Geben Sie die Rechenart ein\n(1 = +, 2 = -, 3 = *, 4 = /): ";
- int bla;
- cin >> bla;
- cout << endl;
- cout << "Geben Sie die erste Ziffer ein: ";
- int x;
- cin >> x;
- cout << endl;
- cout << "Geben Sie die zweite Ziffer ein: ";
- int y;
- cin >> y;
- cout << endl;
- rechnen(bla, x, y);
- system("PAUSE");
- }
Add Comment
Please, Sign In to add comment