/* Sample calculator code * This code is one solution to Assignement 2. * It can be used as a starting point for Lab 3. * Note, it does not catch divide by zero errors. * Written by Terry Soule * Sept. 8, 2017 */ #include using namespace std; int main(){ double operand1; double operand2; int operation; cout << "\n\n"; cout << "Welcome to the simple calculator program.\n"; cout << "Enter two real values and then select the \nmathematical operation to apply to them.\n"; cout << "Enter your first value: "; cin >> operand1; cout << "Enter your second value: "; cin >> operand2; cout << "Enter your operation (1-add, 2-subtract, 3-multiply, 4-divide): "; cin >> operation; if(operation == 1){ cout << operand1 << " + " << operand2 << " = " << operand1+operand2; } if(operation == 2){ cout << operand1 << " - " << operand2 << " = " << operand1-operand2; } if(operation == 3){ cout << operand1 << " * " << operand2 << " = " << operand1*operand2; } if(operation == 4){ cout << operand1 << " / " << operand2 << " = " << operand1/operand2; } cout << "\n\n"; }