In my data structures class, I have to implement an algorithm in c++ to convert an infix to a postfix expression. The algorithm makes sense to me outside of one small detail, most tutorials I've seen, as well as most people on sites such as stack overflow advise returning the postfix expression in a queue, since it is a FIFO data structure. However, In my assignment, I am required to return a stack with the postfix expression and since stacks are LIFO data structures, every time I do this, I get the expression in reverse.
Could anyone explain how I could do this? I'm not looking for anyone to do my homework or anything. I know what to do with the code if I could just understand the concept.