Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int x, y, z;
- string dzialanie,dodawanie,odejmowanie,mnozenie,dzielenie;
- int main()
- {
- while (1)
- {
- cout << "Wpisz pierwsza liczbe calkowita: ";
- cin >> x;
- cout << "wpisz druga liczbe calkowita: ";
- cin >> y;
- cout << "wybierz dzialanie: dodawanie,odejmowanie,mnozenie,dzielenie:" << endl;
- cin >> dzialanie;
- if (dzialanie == "dodawanie")
- {
- z = x + y;
- cout << z;
- }
- else if (dzialanie == "odejmowanie")
- {
- z = x - y;
- cout << z;
- }
- else if (dzialanie == "mnozenie")
- {
- z = x * y;
- cout << z;
- }
- else if (dzialanie == "dzielenie")
- {
- if (y == 0)
- {
- cout << "nie dzieli sie przez 0 cepie";
- }
- else
- {
- z = x / y;
- cout << z;
- }
- }
- else
- {
- cout << "blad";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement