starters help in the if statement

This is a discussion on starters help in the if statement within the C++ Programming forums, part of the General Programming Boards category; at the end of the if statement turtorial there comes the && !. how do you put the and or ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    15

    starters help in the if statement

    at the end of the if statement turtorial there comes the && !.
    how do you put the and or not in the function

  2. #2
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572
    meh?

    lets say you are checking for two things, if a glass is full and if it has ice in it (sorry for the stupid example)
    Code:
    bool is_full = true;
    bool ice = true;
    if( is_full && ice )
          std::cout << "ahhh...cool fresh drink"<< std::endl;
    the && [and] checks both of the variables...of one of them is false it doesn't check the second, and the if body is not executed.

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Usefulness of the "else if" statement
    By gn17 in forum C Programming
    Replies: 7
    Last Post: 08-12-2007, 05:19 AM
  2. If Else statement problem
    By doofusboy in forum C Programming
    Replies: 2
    Last Post: 11-09-2005, 06:18 AM
  3. if/break statement
    By Apropos in forum C++ Programming
    Replies: 7
    Last Post: 02-22-2005, 01:33 PM
  4. string & if statement
    By Curacao in forum C++ Programming
    Replies: 4
    Last Post: 05-02-2003, 09:56 PM
  5. Uh-oh! I am having a major switch problem!
    By goodn in forum C Programming
    Replies: 4
    Last Post: 11-01-2001, 03:49 PM

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