I have a newbie question...:/

This is a discussion on I have a newbie question...:/ within the C++ Programming forums, part of the General Programming Boards category; Okay, so I've been learning C++. I got to the second page in the tutorials, and can make my computer ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    2

    Unhappy I have a newbie question...:/

    Okay, so I've been learning C++. I got to the second page in the tutorials, and can make my computer say stuff. I can even talk back to it. But, then I got to booleans and got stuck. I understand the <, >, ==, all of that stuff, but evaluating gets me completly puzzled.

    !( 1 || 0 )

    That's what I'm talking about. It says to evaluate it. I understand that ! means NOT and stuff, but how to I get it down to 1 or 0?

    Thanks SO much.

  2. #2
    Registered User
    Join Date
    Apr 2006
    Posts
    2,053
    It's just like regular arithmetic, except with 1 and 0 instead of real numbers.

    || is like addition, && is like multiplication, and not does not have a direct analogue.

    So just as you would simplify 7+3*5 to 7+15 and then to 22, so you would simplify !(1||0) to !(1) and then to 0.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    2
    It's just like regular arithmetic, except with 1 and 0 instead of real numbers.

    || is like addition, && is like multiplication, and not does not have a direct analogue.

    So just as you would simplify 7+3*5 to 7+15 and then to 22, so you would simplify !(1||0) to !(1) and then to 0.
    OH! It makes so much sense now! Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie question, C #
    By mate222 in forum C# Programming
    Replies: 4
    Last Post: 12-01-2009, 06:24 AM
  2. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 05:43 AM
  3. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  4. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 10:50 AM

Tags for this Thread


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