Solved

getting a value from a string formula [BCB3]

Posted on 2002-04-28
5
205 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

929 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

8 Experts available now in Live!

Get 1:1 Help Now