SHARE
TWEET

Calculator

_OrichalcumQST_ Aug 21st, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Author sasha0552
  2. #include <iostream>
  3.  
  4. int main() {
  5.     char oper;
  6.     float first, second;
  7.     std::cout << "Simpe Calculator by sasha0552" << std::endl << "Enter first number" << std::endl;
  8.     std::cin >> first;
  9.     std::cout << "Enter operator" << std::endl;
  10.     std::cin >> oper;
  11.     std::cout << "Enter second number" << std::endl;
  12.     std::cin >> second;
  13.     std::cout << "Result is ";
  14.     switch (oper) {
  15.     case '+':
  16.         std::cout << first + second << std::endl;
  17.         break;
  18.     case '-':
  19.         std::cout << first - second << std::endl;
  20.         break;
  21.     case '*':
  22.         std::cout << first * second << std::endl;
  23.         break;
  24.     case '/':
  25.         std::cout << first / second << std::endl;
  26.         break;
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top