Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int Fib(int i)
  5. {
  6.     if (i == 0 || i == 1) return 1;
  7.     return Fib(i - 1) + Fib(i - 2);
  8. }
  9.  
  10. int main()
  11. {
  12.     /*int n;
  13.     cin >> n;
  14.     for (int i = 0; i < n; i++)
  15.     {
  16.         cout << Fib(i) << " ";
  17.     }
  18.     */
  19.  
  20.     double a, b, result;
  21.     char c;
  22.     cin >> a >> c >> b;
  23.  
  24.     switch (c)
  25.     {
  26.         case '+': result = a + b; break;
  27.         case '-': result = a - b; break;
  28.         case '*': result = a * b; break;
  29.         case '/': result = a / b; break;
  30.         default:break;
  31.     }
  32.  
  33.     cout << a << c << b << "=" << result << endl;
  34.    
  35.     system("pause");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement