You will implement a calculator using stacks and queues in C++. You may use the STL. Your calculator must support the following operators:
The input will be given in the form of infix expressions. For example, ( 20.4 + 3 ) * -5, where each operator or operand is separated by a space. Implement parentheses checking to ensure that the input is a valid expression. If the expression is not valid, output an error message. Convert the checked infix expression into a postfix expression. For example, the above infix expression would covert to 20.4 3 + -5 *. Use a stack for the infix to postfix conversion. Store the resulting postfix expression in a queue and print it onto the screen. Then, using a second stack, evaluate the postfix expression and print the result.
Here is sample output (input in bold green):
Enter a valid infix expression: 3 + 4 * 5 / 6
The resulting postfix expression is: 3 4 5 * 6 / +
The result is: 6.33333
Your program should accept integers and floating-point numbers, including negative numbers, as operands. Additionally, your program should accept only those operators indicated above. You may assume valid infix expression input, though parentheses may be invalid (and need to be checked/matched). All operators, with the exception of exponent (^), have left-to-right associativity.