aboutsummaryrefslogtreecommitdiffstats
path: root/ee1301/wk2/lab2
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ee1301/wk2/lab2/calc.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/ee1301/wk2/lab2/calc.cpp b/ee1301/wk2/lab2/calc.cpp
index ebe95f4..fbc82dd 100644
--- a/ee1301/wk2/lab2/calc.cpp
+++ b/ee1301/wk2/lab2/calc.cpp
@@ -6,5 +6,18 @@ int main () {
char op;
cout << "Enter an equation: ";
cin >> a >> op >> b;
- cout << a << op << b << " = " << << endl;
-}
+ 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;
+ }