Thread: Need help

  1. #16
    Registered User
    Join Date
    Nov 2007
    Location
    Free Country, USA
    Posts
    105
    No. I have no idea who DAX is.

  2. #17
    Registered User
    Join Date
    Dec 2007
    Posts
    12
    PSP hacks, M33?

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by C-+ View Post
    Code:
        if ( num%2 == 1.);{
             cout<<"The number is unpair\n";
        }
    The "." is only valid for objects, since it's an operator. You're comparing numbers, so it's invalid. Remove it.
    IFs do not use a semicolon ( ; ) after it. If you put it there, it the same as removing the entire if because you're telling the compiler to do the IF but nothing to do IF the IF is true. Thus it will optimize it away.

    Code:
        else if(num%2==1);{
             cout<<"The number is pair\n";
        }
    Should be else if (num % 2 == 0) since you've already checked for 1.

  4. #19
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    1. is shorthand for 1.0.

  5. #20
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    num is an integer.
    And 1. is silly and confusing, make it 1.0 or 1.0f or better yet, just 1, since num is an integer and &#37; returns an integer.

Popular pages Recent additions subscribe to a feed