Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string operand;
- cout << "Enter Operator, eg: +, -, *, or /" << endl;
- cin >> operand;
- if (operand == "+") {
- float input1;
- float input2;
- cout << "Enter input 1." << endl;
- cin >> input1;
- cout << "Alright, enter input 2." << endl;
- cin >> input2;
- cout << "The sum is " << input1 + input2 << endl;
- return 0;
- } else if (operand == "-") {
- float input1;
- float input2;
- cout << "Enter input 1." << endl;
- cin >> input1;
- cout << "Alright, enter input 2." << endl;
- cin >> input2;
- cout << "The sum is " << input1 - input2 << endl;
- return 0;
- } else if (operand == "*") {
- float input1;
- float input2;
- cout << "Enter input 1." << endl;
- cin >> input1;
- cout << "Alright, enter input 2." << endl;
- cin >> input2;
- cout << "The sum is " << input1 * input2 << endl;
- return 0;
- } else if (operand == "/") {
- float input1;
- float input2;
- cout << "Enter input 1." << endl;
- cin >> input1;
- cout << "Alright, enter input 2." << endl;
- cin >> input2;
- cout << "The sum is " << input1 / input2 << endl;
- return 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement