Thread: Can someone explain what this means??

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    44

    Can someone explain what this means??

    Code:
    if(lines++%20==19)
    I'm using Bloodsheds Dev-C++ Compiler.

    JamMan..

    Curious if I can live forever? CLICK HERE

  2. #2
    Still A Registered User DISGUISED's Avatar
    Join Date
    Aug 2001
    Posts
    499
    This is simply testing to see if the reamainder (modulous %) of dividing the value contained in lines by 20 is equal to 19. I imagine this statement is contained in a loop because the value of lines is then incremented by one. Hope that helps. Have a nice day.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    44
    Hi, dont fully understand that, but nearly..

    How would I write a program that put certain lines of a text file onto a certain x,y on the screen.
    I'm using Bloodsheds Dev-C++ Compiler.

    JamMan..

    Curious if I can live forever? CLICK HERE

  4. #4

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    44
    Dont understand, I just don't understand what it means!..[IMG][/IMG]

    Sorry http://www.rsownersclub.co.uk/ubb/confused.gif
    I'm using Bloodsheds Dev-C++ Compiler.

    JamMan..

    Curious if I can live forever? CLICK HERE

  6. #6
    Registered User
    Join Date
    Aug 2001
    Posts
    154

    Re: Can someone explain what this means??

    Originally posted by JamMan
    Code:
    if(lines++%20==19)
    lines++ // incremant the value contained in lines by 1. If lines == 16, lines++ sets lines to 17

    lines++ % 20 // divide lines by 20 and find the remainder. If lines == 25, lines % 20 == 5.

    lines++ % 20 == 19 // if that remainder == 19

    There could be a problem with lines++ as to when it increments: before or after the modulus operation. This stuff causes weird problems, and there are threads on the board about this if you search. I think it's compiler dependant, but check first.

  7. #7
    Registered User
    Join Date
    Nov 2001
    Posts
    44
    Cheers Brown Drake think I got it now.
    I'm using Bloodsheds Dev-C++ Compiler.

    JamMan..

    Curious if I can live forever? CLICK HERE

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. One Easy" C " Question. Please Solve and Explain.
    By RahulDhanpat in forum C Programming
    Replies: 18
    Last Post: 03-24-2008, 01:39 PM
  2. Please Explain me few terms that i have listed in here.
    By chottachatri in forum C++ Programming
    Replies: 3
    Last Post: 02-26-2008, 08:20 AM
  3. Please explain?
    By neo_phyte in forum C Programming
    Replies: 3
    Last Post: 08-25-2006, 05:23 AM
  4. Pls explain how this program works...
    By Unregistered in forum C Programming
    Replies: 9
    Last Post: 01-05-2002, 09:53 AM
  5. Can someone explain what the EXP(X) function means?
    By raptor2xtreme in forum C++ Programming
    Replies: 2
    Last Post: 11-07-2001, 12:19 AM