diff options
Diffstat (limited to '')
-rw-r--r-- | ee1301/wk2/lab2/calc.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ee1301/wk2/lab2/calc.cpp b/ee1301/wk2/lab2/calc.cpp index fbc82dd..f2e0e87 100644 --- a/ee1301/wk2/lab2/calc.cpp +++ b/ee1301/wk2/lab2/calc.cpp @@ -7,17 +7,22 @@ int main () { cout << "Enter an equation: "; cin >> a >> op >> b; cout << a << op << b << " = "; + if (op=='+'){ cout << a + b; } + if (op=='-'){ cout << a - b; } + if (op=='*'){ cout << a * b; } + if (op=='/'){ cout << a / b; } + cout << endl; } |