Solved

getting a value from a string formula [BCB3]

Posted on 2002-04-28
5
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

751 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