Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Text analisator, for example we have input string: "y = (x^2)/2", how can we calculate that in any language(C++, C#, C or Pascal)?

Some C++ prototype:
...
object = new string_analisator_object->set("y = (x^2)/2");
...
double y = 0;
double x = 0;
...
Ofcourse we know that is a "x":
...
array params = { (for example our x = 3.12) };
object->set(params);
...
double result = object->calculate();
...

So, maybe anyone have solutions?
Posted

1 solution

There are many options:


Of course the last point is the more difficult (but you would gain insight). Still there are tools (just to name few: flex and bison for C, ANTLR for Java, Boost.Spirit for C++) that could help you a lot.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900