Go to Post the rookies come up with amazing stuff (I have seen it happening), they amaze me at times. - Arefin Bari [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 25-07-2010, 14:29
buildmaster5000 buildmaster5000 is offline
Trying to program the swerve drive
AKA: Alex
FRC #2421 (Rolling Thunder Robotics)
Team Role: Alumni
 
Join Date: May 2009
Rookie Year: 2009
Location: Northern Virginia
Posts: 207
buildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud ofbuildmaster5000 has much to be proud of
Re: comparing integer lists

Is this LabView, Java or C++??

In Java (the only language I know), I would use nested for loops that would compare an element in the first array wiht each element in the second array. An example is below, where any number that is found in the other array is changed to -1.
Code:
    public class ArraySort
   {
       public static void main(String[]args)
      {
         int[] num1={1,3,4,5,6,8,10,15,19,20,55,99,100,115,156,205};
         int[] num2={0,2,3,4,6,7,10,19,20,45,55,65,100,156,200,256};
      
      //check for equal variables, if one is found, set element to -1
         for(int x=0; x<num1.length; x++)
         {
            for(int a=0; a<num2.length; a++)
               if(num1[x]==num2[a])
               {
                  num1[x]=-1;
                  num2[a]=-1;
               }
         }
         	//print the arrays
         for(int x=0; x<num1.length; x++)
            System.out.print(num1[x]+" ");
      
         System.out.println();
            	      
         for(int x=0; x<num2.length; x++)
            System.out.print(num2[x]+" ");
      }
   }
__________________
-Alex



2010 Washington DC Regional: Engineering Excellence Award
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Should we really be comparing Breakaway to soccer? XaulZan11 Rules/Strategy 9 13-02-2010 15:22
Merging/Comparing LabVIEW VIs Terry Sherman NI LabVIEW 7 30-08-2009 10:30
Comparing Sensor Readings in NQC ZACH P. Programming 5 30-08-2003 17:33
Integer Number powercat Programming 2 18-02-2003 11:26
Spreadsheet comparing ALL First motors Nuts4FIRST Motors 0 08-01-2002 09:20


All times are GMT -5. The time now is 23:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi