Guest User

Untitled

a guest
Apr 13th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <conio.h>
  3. #include <math.h>
  4. #include <iostream>
  5. using std::cout;
  6. using std::cin;
  7. int main()
  8. {setlocale(LC_ALL, "Russian");
  9. cout<< "Добро пожаловать в консольный калькулятор.\nВведите по порядку: число, знак(+,-,/,*), число.\n";
  10. double a, c; char b; int i;
  11. cin >>a >>b >>c;
  12.     if (b == '+') cout << "Ответ: " << a + c <<"\n";
  13.     else if (b =='-') cout << "Ответ: " <<a - c << "\n";
  14.          else if (b == '*') cout << "Ответ: " << a * c << "\n";
  15.               else if (b == '/') cout << "Ответ: " << a / c << "\n";
  16.                    else cout << "Данная операция не поддерживается или не существует.\n";
  17. _getch();
  18. return 0;
  19. }
Add Comment
Please, Sign In to add comment