Why is the if statement failed? C++

follow few steps:
1, how you are restricting the duplicates? by number, by location, by name etc… ?
if by number, check if you have duplicate numbers already in the array
if by location, check if you have duplicate locations stored in the array
if by name, check if you have duplicate names in the array

any of them you have twice, your loop will generate duplicate of it and it will be re-stared as infinite loop.

hope it helps
cheers!

1 Like