however I'm not allowed to use classes, pointers, or structs
Type: Posts; User: whitey300
however I'm not allowed to use classes, pointers, or structs
yes that is exactly how I want it to output. How do I set up a stack for it to work though?
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...
As of now my program as the user input an expression like *2x and then the program outputs it as
*
2
x
I am wanting to display zeros next to the elements, 2 columns of zeros so the output...
As of now my program as the user input an expression like *2x and then the program outputs it as
*
2
x
I am wanting to display zeros next to the elements, 2 columns of zeros so the output...
ok so how would I then output the elements the user inputs into the left column. Do I need a for loop or how would do I need to go about it?
I need to have the program take a user's input in prefix notation and display it in a left child-right child array representation of a tree.
Ex: input: *2x
output:
...