Kacper_Michalak

Seria 2 Zadanie 13

Nov 14th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x,y;
  8.     char z = ' ' ;
  9.     int ex;
  10.     cout << "Podaj pierwsza liczbe:" << endl;
  11.     cin >> x;
  12.     cout << "Podaj druga liczbe: " << endl;
  13.     cin >> y;
  14.     cout << "Podaj znak: " << endl;
  15.     cin >> z;
  16.  
  17.     if ( z == '*')
  18.     {
  19.         ex = x * y;
  20.         cout << "Mnozenie wynosi: " << ex;
  21.     }
  22.     else if ( z == '-')
  23.     {
  24.         ex = x - y;
  25.         cout << "Odejmowanie wynosi: " << ex;
  26.     }
  27.     else if ( z == '/')
  28.     {
  29.         ex = x / y;
  30.         cout << "Dzielenie wynosi: " << ex;
  31.     }
  32.     else if ( z == '+')
  33.     {
  34.         ex = x + y;
  35.         cout << "Dodawanie wynosi: " << ex;
  36.     }
  37.     return 0;
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment