Click to See Complete Forum and Search --> : Help in Expression Evaluation


muthu555
June 22nd, 2002, 04:13 AM
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

wake
June 23rd, 2002, 01:23 AM
if( (((a=b)&&(b<=c))|| (f>=g)) )
{
/*true*/
}
else
{
/*false*/
}That?

zdf
June 23rd, 2002, 03:00 AM
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!


:)

cup
June 30th, 2002, 04:38 PM
I think Wake's reply should have been


if( (((a==b)&&(b<=c))|| (f>=g)) )
{
/*true*/
}
else
{
/*false*/
}