This isn't so much C++ related as it is to making a general algorithm, but since the program will be written in C++ I decided to post it here.

Basically, the program needs to read a text file which contains a mathematical formula.

It is formatted like this:

Input file example: For 3*x will look like

*

3

x

Input file example: For (7*(5*x))^2

^

*

7

*

5

x

2

Every equation will have a variable x in it somewhere.

Basically what I am trying to figure out is how I can transform the input into formula form.

I have heard this is how compilers (csc in C# at least) translate formulas in the first place, and have done on paper examples of how to move from one form to the other. If so, does anyone remember what it is called so I can do some reading on it?

What the program will do is if the text file has:

*

3

x

It will print 3 * x, and then ask the user to input an x and provide the product.