Advertisement
Josif_tepe

Untitled

May 7th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void kalkulator(int a, int b, char c) {
  6.     if(c == '+') {
  7.         cout << a + b << endl;
  8.     }
  9.     else if(c == '-') {
  10.         cout << a - b << endl;
  11.     }
  12.     else if(c == '*') {
  13.         cout << a * b << endl;
  14.     }
  15.     else if(c == '/') {
  16.         cout << a / b << endl;
  17.     }
  18. }
  19. int main() {
  20.     int a, b;
  21.     cin >> a;
  22.     cin >> b;
  23.     char c;
  24.     cin >> c;
  25.     kalkulator(a, b, c);
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement