CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Posts
    56

    Lightbulb Array competition

    If I have 2 arrays how can that be compared in an infite loop ?
    The longer the loop takes the more fruitful outcomes I can obtain, right ?

    So tell me what is the payoff ?
    -----

  2. #2
    Join Date
    Aug 2008
    Location
    India
    Posts
    186

    Re: Array competition

    Quote Originally Posted by yuenqi View Post
    If I have 2 arrays how can that be compared in an infite loop ?
    The longer the loop takes the more fruitful outcomes I can obtain, right ?

    So tell me what is the payoff ?
    I did'nt get what are you trying to do... Infinite loop..??? Why..???
    Post any code snippet... !!!

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Array competition

    Quote Originally Posted by yuenqi View Post
    If I have 2 arrays how can that be compared in an infite loop ?
    The longer the loop takes the more fruitful outcomes I can obtain, right ?

    So tell me what is the payoff ?
    Arrays are sequences with a fixed, finite length. I don't see how it makes sense to compare them in an infinite look.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Array competition

    Well, the question is very hard to understand, so I could only guess what OP meant. So some thoughts:
    1. Arrays *differ* is they have different length.
    2. Arrays *differ* if at least one element in the first array is not equal to any element in another array.
    So, to compare them:
    • compare the length
    • if both have the same length - sort elements in both arrays and compare them per-element until the end of arrays or until the element will be different
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured