+ 2
What is use of Stacks in c++?
what is its use? and How to implement in c++?
1 Antwort
+ 1
To see how to implement it, you can go and see my codes (I know, it is bad to advertise like that ... ^^), I've done it (also Queue)
It can be use for example to read a mathematical expression stored in a string such as "28*( 3+2)", you'll push the last result in the stack, then push number and their operator while you do not find an operator of lower or equal importance (example + < * < () ) then do the operation (pop the value and the operator) and do it again