Thread: Help with tutorial

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    3

    Help with tutorial

    Hello all,

    New user to C/C++ here and I have been going through the tutorials on this site to better understand it. I am confused by the following section though and am hoping someone will help me understand it.

    Code:
    A. !( 1 || 0 )         ANSWER: 0	
    B. !( 1 || 1 && 0 )    ANSWER: 0 (AND is evaluated before OR)
    C. !( ( 1 || 0 ) && 0 )  ANSWER: 1 (Parenthesis are useful)
    To specify, what I do understand is the operators themselves, but don't appreciate what is being performed in each of the above cases. Meaning, I am aware of how comparison operators can be used to check the value of variables, but why does the statement [NOT (1 OR 0)], by itself, return anything at all? I guess I'm confused as to why any of the above statements (A, B, or C) aren't completely useless, and why they conclude with a value. Hopefully that makes sense.

    Thanks in advance for any help.
    Last edited by alaric24; 06-19-2006 at 04:48 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 07:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 01:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 02:49 PM
  5. My DirectInput tutorial....
    By jdinger in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-18-2002, 11:32 PM