What is use of Stacks in c++? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

What is use of Stacks in c++?

what is its use? and How to implement in c++?

28th Dec 2016, 1:37 PM
Manish Garg
Manish Garg - avatar
1 Réponse
+ 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
29th Dec 2016, 1:12 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar