Thread: I don't know...

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    4

    Question I don't know...

    Im wondering how to... i guess, link two things togeter.

    lets say i did a simple loop and then i want to do an if statement thing... When i compile it, it doesn't have errors but when i run the program, all it does is the loop and not the if. Please help a new C++ programmer

  2. #2
    Registered User NewtonApple's Avatar
    Join Date
    Aug 2001
    Posts
    11
    Hm.. it'd be helpful if you'd show some code. but one of most common errors is adding a semicolon after the looping statement:
    Code:
    for ( int i = 0; i < 10; i++ ); //<---right here take the semicolon out
    {
        if ( something == nothing )
        { 
              cout << "NOTHING is really something!";
        }
    }
    another common error is the logical condition in your if statement is actually a contradiciton (always false). check and see if that's the case.. again, some code would be better off for others to help u more effeciently.
    Everyone sucks... because of gravity...

  3. #3
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    >actually a contradiciton

    well, it'd not be considered a conditional... not necessarily a contradiction... and about that, your compiler might have options for warning on cases which always held true [with constants/hardcoded values and even with variables sometimes...]

    any code? check your compiler for these things... what compiler are you on?
    hasafraggin shizigishin oppashigger...

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    4

    Lightbulb Thanx

    Ill try that

Popular pages Recent additions subscribe to a feed