View Single Post
  #18 (permalink)  
Old 04-23-2008, 03:09 PM
raj reddy raj reddy is offline
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
hi sanjeev



i will give u a clear idea




think in


array al1={1,2}

array al2={1,2,3,4,5,6,7,8,9,10,11,12}


Now what i have to do is


if (al1(elements)==compare al2(only4 elements 1,2,3,4))
{
/*continues my logic*/
}
else if (al1(elements)==compare al2(only4 elements)ie 5,6,7,8)
{
/*continues my logic*/
}


else if (al1(elements)==compare al2(only4 elements)ie 8,9,10,11,12)
{
/*continues my logic*/
}


the above output of comparing the two arrays i need in two for loops then the CODE will be


MY CODE:



array al1={1,2}

array al2={1,2,3,4,5,6,7,8,9,10,11,12}



int arrayList1_Length = al1.size();
int arrayList2_Length = al2.size();





for (int i=1;i<arrayList2_Length;i++) {




for (int j=1;j<arrayList1_Length; j++) {

{




}}
}




In my code all the values of all are comparing with all the elements of al2.

This is not what i need.


I need to be compare everytime with all the elements of al1 and only 4 elements of array2 (upto the end of all the elements of array al2 )



that means al1 will be constant


al2 will be looping for every 4 elements


think that there were 12 elements in al2, so 4 times the inner loop will move



i need the code in the loops


NOTE: DONOT CONSIDER WHETHER THE ELEMENTS WERE MATCHABLE OR NOT, ONLY WE HAVE TO COMPARE THE VALUES ACCORDING TO THE NO OF ELEMENTS , I WILL WRITE MY OWN LOGIC ISIDE THE LOOPS

ANY QUERIES REPLY ME BACK .

Last edited by raj reddy : 04-23-2008 at 03:13 PM.
Reply With Quote