8000 Fix logic errors · vpodaruev/programming-with-cpp@fd9eb89 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd9eb89

Browse files
committed
Fix logic errors
1 parent e5a5be8 commit fd9eb89

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

projects/05/calculator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Token Token_stream::get()
7474
case '5':
7575
case '6':
7676
case '7':
77+
case '8':
7778
case '9':
7879
{
7980
cin.putback(ch); // put digit back into the input stream
@@ -127,6 +128,7 @@ double term ()
127128
case '*':
128129
left *= primary();
129130
t = ts.get();
131+
break;
130132

131133
case '/':
132134
{
@@ -161,7 +163,7 @@ double expression ()
161163
break;
162164

163165
case '-':
164-
left += term(); // evaluate Term and subtract
166+
left -= term(); // evaluate Term and subtract
165167
t = ts.get();
166168
break;
167169

0 commit comments

Comments
 (0)
0