View Single Post
Join Date: Nov 2007
Posts: 68
Reputation: jsosnowski is an unknown quantity at this point 
Solved Threads: 11
jsosnowski's Avatar
jsosnowski jsosnowski is offline Offline
Junior Poster in Training

Re: Comparing and searching two arrays

 
0
  #2
Dec 2nd, 2008
Originally Posted by smorton123 View Post
procedure search_for_numbers (numbers: a; user: b; var counter: integer);
var
subscript: integer;
begin
for subscript := 1 to 7 do
begin
if user[subscript] = numbers[subscript] then
counter := counter + 1;
end;
end;
end.
It only checks the matching subscript numbers because that is what you have told it to do. IF you want to compare each number in "user" with each number in "number" you must set up a second for loop within the first, similar to what you have above to sort numbers in the add_numbers method.
Reply With Quote