View Single Post
  #24 (permalink)  
Old 04-24-2008, 02:21 PM
raj reddy raj reddy is offline
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
Hi sanjeev








Requirement : count variable should increment upto the last comparison of the arrays.

ie count=1,2,3,4,5....upto last comparison of the arrays like that


and also count variable should be increased if and only if the two arrays values are equal

everything is fine but only the count variable is not incrementing for the last comparison of the arrays

Let us think that there are two arrays al1 and al2;




MY CODE:

al1={1,2,3}


al2=(1,2,3,4,5,6,7,8,9}



int count=0;


for (int i=0;i<al1.size();i++) {
{

for (int j=0;j<al2.size(); j++) {



if(al1.get(i).equals(al2.get(j)))

count++;


}


Actually the count variable should increment for every comparison of the al1 and al2.


MY PROBLEM IS : THe variable is incrementing fine for every comparison , but for the last comparison of the arrays the count variable is not incrementing.


can u validate the count variable such a way that i have to get the last comparison value of the two arrays.

PLS SEND ME THE UPDATED CODE
Reply With Quote