diff options
author | Matthew Strapp <msattr@gmail.com> | 2019-02-13 13:57:59 -0600 |
---|---|---|
committer | Matthew Strapp <msattr@gmail.com> | 2019-02-13 13:57:59 -0600 |
commit | 3299e23e5e18f77d0d93fa345809787333b91c89 (patch) | |
tree | 57ec2244510feaa95310de40be36dd15c6986b57 /ee1301/wk2/lab2 | |
parent | Doing fixes before lab (diff) | |
download | homework-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
Diffstat (limited to 'ee1301/wk2/lab2')
-rw-r--r-- | ee1301/wk2/lab2/calc.cpp | 17 |
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; + } |