Solved

getting a value from a string formula [BCB3]

Posted on 2002-04-28
5
204 Views
Last Modified: 2010-08-05
Is there a way to take a AnsiString like:

AnsiString formula;
formula = "(4*5)+(12/3)";

and changing that formula to a float value without parsing the string.

For instance I'm using a TEdit control the user is inputing a formula or just a chain of like: 1+2/3

Thanks





0
Comment
Question by:wolfpackinc
5 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 6976888
Not using standard C++.
0
 
LVL 3

Accepted Solution

by:
jtm111 earned 100 total points
ID: 6977300
You should use a commercial math interpreter library or component. A good place to start looking is here:

http://www.mathtools.net/C++/Interpreters/
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 6978435
or write your own parser to do the job
0
 
LVL 4

Expert Comment

by:pagladasu
ID: 6978439
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7036270
Please update and finalize this old, open question. Please:

1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.

EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.

Thanks,

** Mindphaser - Community Support Moderator **

P.S.  Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now