Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- int main()
- {
- double x, z, y;
- char t;
- std::cout << "Your first number";
- std::cin >> x;
- std::cout << "Your second number";
- std::cin >> y;
- std::cout << "Operation with number";
- std::cout << "1.+\n2.-\n3.*\n4.**\n5./\n6.sqrt\n7.log\n";
- std::cin >> t;
- if (t == '1')
- z = x + y;
- if (t == '2')
- z = x - y;
- if (t == '3')
- z = x * y;
- if (t == '5')
- z = x / y;
- if (t == '4')
- z = pow(x, y);
- if (t == '6')
- z = sqrt(x);
- if (t == '7')
- z = log(y) / log(x);
- std::cout << "Result is" << z;
- return 0;
- }
Add Comment
Please, Sign In to add comment