Well, the break statement hides the logic flaw, giving actually the correct result. Anyway, if you move the inizialization cmpflag=0; outside the while loop and don't use the break statement, your code will still work fine, but is somewhat inefficient. YOu should note that you're searching for a matching entry and if you find it, no matter how many different entries there are, cmpflag should remain 1. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]