Originally Posted by
whitey300
My current program takes user input for an expression tree, example *2x and outputs
* 0 0
2 0 0
x 0 0
*2x is stored in a string.
the 2nd and 3rd columns represent a left-child right-child array. When one of the following operands are input "+ - * / " the zeros need to be changed to the locations of their child's. Like in this example 2 would be the left child of * and x would be the right child so the output should look like
* 1 2
2 0 0
x 0 0
The only way I have thought to do this is to use a switch statement to look for the operands but I don't know how to call on the index that it's child is in.