l8: A simple calculator

l8: A simple calculator

You cannot submit for this problem because the homework's deadline is due.

Description

Your first task is to write a simple calculator according to the algorithm in the previous part.
You should use std::string and std::stack in your implementation.

Format

Files

You should submit a tar file containing a c++ source file l8.cpp

Input

a string on one line, only with integers ranged in [0, 9] and operators +,-,*,/. There
may be spaces in any part of the input string.

Output

the result of the input expression

Sample 1

Input

1 + 2*3 - 4

Output

3

Sample 2

Input

7 /6/9+ 4-7/ 2 - 8 / 6* 8/ 5 *9-3-5/7+6/ 5-5- 4* 5+5*9- 1+2/ 4+4*7*3 +8+5 *9+8+9-5 / 6 -2*5+ 6/ 8 +3-9*9 - 9 - 3/1-1 /6 +4 - 9-5+4+7 *2+3*9-9+ 4-9 + 3 /1 *8* 4 /7*2-7/7/3- 4*2 / 3 + 1-6-7+7-3+9 - 9 /6 *1 -9* 8 *6 * 1 -3 /9 /7/3+2+2- 3*8*8 +6* 3-8-4+6*7/2-4 -8*2

Output

-505

Limitation

1s, 32MiB for each test case.

Lab 8

Not Claimed
Status
Finished
Problems
1
Open Since
2018-07-30 18:00
DDL
2018-08-03 23:59
Extension
240.0 hour(s)