Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int x , y, obliczenie;
- cout << "Podaj pierwsza liczbe: " << endl;
- cin >> x;
- do{
- cout << "Podaj rodzaj operacji: \n(1)dodawanie \n(2)odejmowanie \n(3)mnozenie \n(4)dzielenie \n(5)modulo \n(0)wyjscie" << endl;
- cin >> obliczenie;
- switch(obliczenie)
- {
- case 1:
- cout << "Podaj druga liczbe: " << endl;
- cin >> y;
- x += y;
- cout << x << endl;
- break;
- case 2:
- cout << "Podaj druga liczbe: " << endl;
- cin >> y;
- x -= y;
- cout << x << endl;
- break;
- case 3:
- cout << "Podaj druga liczbe: " << endl;
- cin >> y;
- x *= y;
- cout << x << endl;
- break;
- case 4:
- cout << "Podaj druga liczbe: " << endl;
- cin >> y;
- x /= y;
- cout << x << endl;
- break;
- case 5:
- cout << "Podaj druga liczbe: " << endl;
- cin >> y;
- x %= y;
- cout << x << endl;
- break;
- // case 6:
- // x = 0;
- // break;
- }
- }while(obliczenie != 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment