Advertisement
AndriikoM

Лекція 1, завдання 3

Oct 17th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7.     int chislo1;
  8.     cout << "Vvedit chislo 1: ";
  9.     cin >> chislo1;
  10.  
  11.     int chislo2;
  12.     cout << "Vvedit chislo 2: ";
  13.     cin >> chislo2;
  14.  
  15.     int act;
  16.     cout << "Enter act (1 - +, 2 - -, 3 - *, 4 - /): ";
  17.     cin >> act;
  18.  
  19.     switch (act)
  20.     {
  21.         case 1: cout << chislo1 + chislo2; break;
  22.         case 2: cout << chislo1 - chislo2; break;
  23.         case 3: cout << chislo1 * chislo2; break;
  24.         case 4: cout << chislo1 / chislo2; break;
  25.         default: cout << "Action not supported!";
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement