Multi-conditional if statements.

This is a discussion on Multi-conditional if statements. within the C++ Programming forums, part of the General Programming Boards category; >>if(!(!A && B || A && !B)) ((!true && false) || true) && !false => true (!true && false) || ...

  1. #16
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>if(!(!A && B || A && !B))
    ((!true && false) || true) && !false => true
    (!true && false) || (true && !false) => true

    Please play again

    100 points for whoever comes up with an expression that won't evaluate to the same thing no matter what order it's evaluated in.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #17
    Registered User
    Join Date
    Oct 2002
    Posts
    22
    Quote Originally Posted by major_small
    fine, how's this:

    if(!(!A && B || A && !B))

    jeebus... and 10 points to anybody whow knows what that gate's called.
    I believe that's an XNOR gate.

    Quote Originally Posted by Hunter2
    100 points for whoever comes up with an expression that won't evaluate to the same thing no matter what order it's evaluated in.
    How about "true || true && false"

    (true || true) && false => false
    true || (true && false) => true
    Last edited by skiingwiz; 03-24-2005 at 12:26 PM.

  3. #18
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    Quote Originally Posted by misplaced
    don't get cute with that piece of information either and do
    Code:
    //bad
    if(x || func())
    Hey, I'd never thought of that one before! Clever! Would it be considered bad practice though?

  4. #19
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Its advised to tell your compiler how you really mean to have something evaluated.

    Code:
    if((x == 1 && y == 2) || (x == 2 && y == 65)) {
      // do stuff.
    }

  5. #20
    Registered User ~Kyo~'s Avatar
    Join Date
    Jun 2004
    Posts
    320
    Quote Originally Posted by major_small
    fine, how's this:

    if(!(!A && B || A && !B))

    jeebus... and 10 points to anybody whow knows what that gate's called.

    edit: and another 20 points to the person who brings me the head of the person that gives me bad rep for trying to be helpful.
    0 0 true
    0 1 false
    1 0 false
    1 1 true
    Could it be a XOR gate?

    Parenthesis, Not, And, Or
    Thats the order that the bools are figured in...

  6. #21
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>How about "true || true && false"
    What the bloody heck.. I spent about half an hour experimenting with varying combinations of those
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #22
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by ~Kyo~
    0 0 true
    0 1 false
    1 0 false
    1 1 true
    Could it be a XOR gate?
    look once again, and you got that last one wrong.
    Quote Originally Posted by skiingwiz
    I believe that's an XNOR gate.
    DING! DING! DING!
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Conditional Statements
    By strokebow in forum C Programming
    Replies: 30
    Last Post: 11-22-2006, 05:08 PM
  3. multi conditional if statements?
    By chaser in forum Game Programming
    Replies: 3
    Last Post: 07-26-2002, 10:52 PM
  4. Using floats in conditional statements
    By DBB in forum C++ Programming
    Replies: 3
    Last Post: 09-12-2001, 07:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21