+ 2

STL Infix postfix prefix C++

Hello friends I am learning different conversations of the above notation . It's very hard to write and manage the code again and again to convert infix to postfix or prefix. So is there any STl library to do it quickly? and other thing I want to know in which cases I can use these conversions?

9th Dec 2020, 11:09 AM
Saad Saleem
Saad Saleem - avatar
4 Respostas
+ 6
C++ stl libraries only contain tools regarding standard commanly used data structures (like stack,queues etc) and algorithms ( like sorting, finding max of 2 etc) There isn't anything for performing take like these. if you find yourself using it a lot then, you can create the following functions once and add it in your own custom header file and then include it whenever you want to use.
9th Dec 2020, 11:18 AM
Arsenic
Arsenic - avatar
+ 3
Saad Mughal in programming infix and postfix notations are used in stack oriented languages like Forth,joy etc, also there are some calculators(like HP-12 ) which use prefix and postfix notations. This is because these expressions are processed much faster as then parser doesn't have to take associativity and precedence into consideration while creating a syntax tree, making the process easier compared to one's using infix notation. But the only downside of this is that it is comparatively difficult to understand for user than infix notation ( as that is what they teach in schools ) that's where these convertors come into play.
9th Dec 2020, 1:21 PM
Arsenic
Arsenic - avatar
+ 2
Arsenic Thanks
9th Dec 2020, 12:17 PM
Saad Saleem
Saad Saleem - avatar
+ 1
Arsenic is it really good to do these conversation whenever you write a code that involve operations?
9th Dec 2020, 12:18 PM
Saad Saleem
Saad Saleem - avatar