From 3299e23e5e18f77d0d93fa345809787333b91c89 Mon Sep 17 00:00:00 2001 From: Matthew Strapp Date: Wed, 13 Feb 2019 13:57:59 -0600 Subject: Finish calculator --- ee1301/wk2/lab2/calc.cpp | 17 +++++++++++++++-- 1 file 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; + } -- cgit v1.2.3