aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2019-02-13 13:57:59 -0600
committerMatthew Strapp <msattr@gmail.com>2019-02-13 13:57:59 -0600
commit3299e23e5e18f77d0d93fa345809787333b91c89 (patch)
tree57ec2244510feaa95310de40be36dd15c6986b57
parentDoing fixes before lab (diff)
downloadhomework-3299e23e5e18f77d0d93fa345809787333b91c89.tar
homework-3299e23e5e18f77d0d93fa345809787333b91c89.tar.gz
homework-3299e23e5e18f77d0d93fa345809787333b91c89.tar.bz2
homework-3299e23e5e18f77d0d93fa345809787333b91c89.tar.lz
homework-3299e23e5e18f77d0d93fa345809787333b91c89.tar.xz
homework-3299e23e5e18f77d0d93fa345809787333b91c89.tar.zst
homework-3299e23e5e18f77d0d93fa345809787333b91c89.zip
Finish calculator
-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;
+ }