I'm a beginner programmer stuck on how to implement this function for my program, any suggestions will be very welcome (save my hair).
I want the user to input a mathematical equation e.g. y=m*x+c (using Visual C++).
My problem is to then find a way that this can be a) used by the program, b) saved to file, c) opened and used from the saved file.
As you can see this has me pretty much stumped......what variable type do i use that will recognise the mathematical symbols? Do i pass the input equation as a string vaiable and then write coding to pull out all mathematical symbols.......like pulling teeth
Help basically.
Thanks.

2. You should read the equation as string, and then start analysing it char by cha, ie: read the symbols, variables, etc...
Then you check if it's in the form that you can solve.
Then start solving...

Where exactly are you stuck?

3. Thought as much......will probably take a lot of work as the equations will include, powers, exponentials, nestled brackets etc.

I've not started writing the code yet as i'm still in the planning stage on program functionalities and so structures.
My problem will basically just be converting between the user input equation as a string and then converting to expressions. Once this is done implementing the equation will be simple. As for saving and loaing the data to/from file ...i'll again use the string format.

Cheers for the help. If you know of any sample coding to analyse the string i would be more than keen to to view it.
Cheers.

4. If I were you I'd pick a language that makes the job trivial :-)
Code:
```#!/usr/bin/perl -w

use strict;

print "Enter an equation: ";
chomp(my \$equation = <STDIN>);

print eval \$equation;```

5. I'll give you some help...
if the user inputs: 5+6
and you read that into a string:
Code:
`char *string;`
you will read string[0], and string[2] and use atoi() to convert it to int.
then you read string[1] and use a swith statement to choose what operator to use.

6. You could try to split the inputted equation into a binary tree. That way, the operations will be a lot easier to handle:
Code:
```12*x + 4*x^2 = 2*x

=
/   \
/     \
+       *
/   \    / \
*     *  2   x
/ \   / \
12  x 4   ^
/ \
x   2```