Thread: Or operator?

  1. #16
    Registered User
    Join Date
    Jan 2005
    >> Pop[index][11] = Pop[index][1]
    This part is wrong. It should be:

    then Pop[index][11] = 1 and fitness = 1.

  2. #17
    Registered User
    Join Date
    Oct 2005
    Perhaps i should have been more clear, but yes.

    If the if statement is true, then Pop[index][11] = 1,

    what i need to know is does this part work as intended:

    (Grid[x-1][y] == 1)

    ie Grid[4][5] equal to 1

  3. #18
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    >> (Grid[x-1][y] == 1)

    Well, if x=5 and y=5, then it should work as intended.

  4. #19
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    if (Grid[x][++y] != 1 && Grid[x][y] != 0 /*|| Grid[x][y] != 3*/)
    This is a really bad idea. Although, due to the fact that && and || are sequence points, it will actually produce predictable results, it is still hard to read and thus hard to maintain.
    Just increment x/y first and then do the test.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Failure to overload operator delete
    By Elysia in forum C++ Programming
    Replies: 16
    Last Post: 07-10-2008, 01:23 PM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Operator Overloading (Bug, or error in code?)
    By QuietWhistler in forum C++ Programming
    Replies: 2
    Last Post: 01-25-2006, 08:38 AM
  5. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM