boolean operators

This is a discussion on boolean operators within the C++ Programming forums, part of the General Programming Boards category; hi there, i'm brandy new to C programming. I'm having trouble understanding the boolean operators, i can solve most of ...

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    2

    boolean operators

    hi there, i'm brandy new to C programming.
    I'm having trouble understanding the boolean operators, i can solve most of them, but some don't quite make sense to me.
    does anyone have a reference guide or link that can go into greater detail than the tutorials, available on the site? i've looked in other places but it's not quite what im looking for. i emphasize the fact that i'm brand spankin' new to this.
    thanks!
    emily

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by forkpie hat View Post
    hi there, i'm brandy new to C programming.
    So why are you posting in the C++ forum?
    I'm having trouble understanding the boolean operators, i can solve most of them, but some don't quite make sense to me.
    If you give an example of what you don't understand, then we may be better able to help.

    One of the common misconceptions is the use of and/or in human language. We can say "Let's go for some tea and coffee...", which doesn't mean "I'd like to have a cup with tea and coffee in the same cup at the same time" or "I'd like a cup of coffee and then a cup of tea". We also use OR in similarly sloppy conventions.

    In computers, X AND Y means "for this to be true, both X and Y must be true", and X OR Y means "true if either or both of X and Y is true".

    Not means "the opposite", so if something is true, it's NOT false. Something NOT false is true.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    2

    Thumbs up

    thank you. i forgot to put ++, i was on my way out the door when i typed it. my bad.

  4. #4
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    920
    You might find it useful that some boolean operators interact like arithmetic ones.
    Code:
    (A || B) && (C || D)   if and only if   (A && C) || (A && D) || (B && C) || (B && D)
    Just like how
    (A+B) * (C+D) = (A*C) + (A*D) + (B*C) + (B*D)
    and
    Code:
    (A && B) || (B && C)   if and only if   B && (A || C)
    Like
    (A*B) + (B*C) = B * (A+C)
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bolean Operators hurt my head. (Trouble understanding) :(
    By Funcoot in forum C++ Programming
    Replies: 3
    Last Post: 01-20-2008, 07:42 PM
  2. C++ and Boolean Operators
    By Rockskin in forum C++ Programming
    Replies: 3
    Last Post: 03-13-2006, 03:45 PM
  3. Boolean operators
    By Trogdor27 in forum C++ Programming
    Replies: 10
    Last Post: 09-12-2005, 07:46 AM
  4. boolean operators
    By bj31t in forum C++ Programming
    Replies: 5
    Last Post: 03-30-2004, 08:34 PM
  5. Boolean Operators?
    By civilwarsearch in forum C++ Programming
    Replies: 11
    Last Post: 12-15-2003, 09:50 PM

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