|
-
June 22nd, 2002, 04:13 AM
#1
Help in Expression Evaluation
Hi,
I am trying to write a code for evaluating a expression for ex :- (((a=b)&&(b<=c))|| (f>=g))
I have to execute this expression and find out if it returns a True or False, so that i can call the "Then" Statement or the "Else" Statement accordingly. I am really cloueless abt how to do this , does anyone, have a code sample or the code itself or any suggestions on how to get going with this????.
thanx
Muthu
-
June 23rd, 2002, 01:23 AM
#2
Code:
if( (((a=b)&&(b<=c))|| (f>=g)) )
{
/*true*/
}
else
{
/*false*/
}
That?
-
June 23rd, 2002, 03:00 AM
#3
You’ll find an excellent example in Bjarne Stroustrup’s book <The C++ Programming Language>.
Mr. Stroustrup explains in chapter <3.1 A Desk Calculator> how to parse an expression.
Good luck!
ZDF
What is good is twice as good if it's simple.
"Make it simple" is a complex task.
-
June 30th, 2002, 04:38 PM
#4
I think Wake's reply should have been
Code:
if( (((a==b)&&(b<=c))|| (f>=g)) )
{
/*true*/
}
else
{
/*false*/
}
Succinct is verbose for terse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|