Advertisement
ZhilinskiyG

Calculator

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