Guest User

Untitled

a guest
Dec 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. int main()
  4. {
  5. double x, z, y;
  6. char t;
  7. std::cout << "Your first number";
  8. std::cin >> x;
  9. std::cout << "Your second number";
  10. std::cin >> y;
  11. std::cout << "Operation with number";
  12. std::cout << "1.+\n2.-\n3.*\n4.**\n5./\n6.sqrt\n7.log\n";
  13. std::cin >> t;
  14. if (t == '1')
  15. z = x + y;
  16. if (t == '2')
  17. z = x - y;
  18. if (t == '3')
  19. z = x * y;
  20. if (t == '5')
  21. z = x / y;
  22. if (t == '4')
  23. z = pow(x, y);
  24. if (t == '6')
  25. z = sqrt(x);
  26. if (t == '7')
  27. z = log(y) / log(x);
  28. std::cout << "Result is" << z;
  29. return 0;
  30. }
Add Comment
Please, Sign In to add comment