On Tue, 8 May 2007, [EMAIL PROTECTED] wrote:

On Mon, 7 May 2007, Andre Poenitz wrote:

>  How is the syntax in C++ for this logic:
> > if (
>      (a == 1) && (b == 1) &&
>      ((C == 1) || (C == -1))
> ) > > I mean how can the OR be included into an AND?

 The only or-less version I can think of is

   if (a == 1 && b == 1 && C*C == 1)

 But that's a bit too obfuscated for my taste...

How about:

        if ( a==1 && b==1 && abs(C)==1 )

But what's the point of loosing the OR? I find Uwe's original version easy to read?

Bad Christian! Don't know the difference between 'lose' and 'loose'.

Hmm... checking it:

        The verb to lose (one o) means "to mislay" (you can lose your
        keys or lose your mind); it's also the opposite of to win.

        Loose (two o's) is usually an adjective, but it can also be a
        verb, and it's easy to confuse it with lose. The verb to loose
        means "to release" or "to let free"; it can also mean "to undo" or
        "to make loose." The pronunciations are also different: to lose
        ends in a z sound; to loose ends in a clear s sound. [Entry added
        26 Jan. 2005.] http://andromeda.rutgers.edu/~jlynch/Writing/l.html

Maybe Uwe did want to "let free" the OR :-)

/C

--
Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr

Reply via email to