Using if statements?!

This is a discussion on Using if statements?! within the C++ Programming forums, part of the General Programming Boards category; n...

  1. #1
    nectron101
    Guest

    Post Using if statements?!

    n

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916

    Re: Using if statements?!

    Originally posted by nectron101
    n
    Thanks for the clear question man!

    Code:
    if(condition)
    {
    ...
    }
    If you want to see if, for example, the variable argh is set to 7, you use the == operator, like this

    Code:
    if(argh==7)
    {
    ...
    }
    If you just do this, the if statement will be true as long as argh is something other than 0:

    Code:
    if(argh)
    {
    ...
    }
    making that code the same as this:
    Code:
    if(argh!=0)
    {
    ...
    }
    Away.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown memory leak with linked lists...
    By RaDeuX in forum C Programming
    Replies: 6
    Last Post: 12-07-2008, 04:09 AM
  2. newbie question - if statements without conditions
    By c_h in forum C++ Programming
    Replies: 2
    Last Post: 07-18-2008, 11:42 AM
  3. C++ If Statements Help
    By moporho in forum C++ Programming
    Replies: 19
    Last Post: 01-18-2008, 08:40 AM
  4. Efficiency of case statements
    By Yasir_Malik in forum C Programming
    Replies: 26
    Last Post: 05-23-2006, 12:36 PM
  5. Need help with "if" statements
    By Harryt123 in forum C Programming
    Replies: 22
    Last Post: 05-14-2006, 09:18 AM

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