posted 20 years ago
I assume you know how to replace the for loop with a while or do loop.
In that loop, put an inner loop that searches the exising elements for a duplicate value. If one is found, set a boolean "duplicate" true and break out of the inner loop.
In the outer loop, if duplicate is true, display an error message instead of inserting an array element and incrementing the array index.
Give this a try. If you have a problem, post your code and we'll help.
[ November 20, 2004: Message edited by: Mike Gershman ]
[ November 20, 2004: Message edited by: Mike Gershman ]
Mike Gershman
SCJP 1.4, SCWCD in process