>Thanks Hugo, Hilmar and Al
>
>Though seeming simple is almost an impossible task,
>because a machine is not able to know which is the wrong number:
>
>1,2,3,6,5
>
>It´s really hard to tell apart if 6 or 5 is incorrect
>
>First it looks like 5 is wrong, but also 6 can be wrong
That's exactly the point (the argument) I was trying to make in my previous message. I don't think your program should automatically correct wrong data (at least, in many cases) - it should point out that there is a problem, and let the user decide how to correct it.
There are many similar situations, where there are inconsistencies between different pieces of data. It is quite often impossible to tell which part is correct, and which part isn't.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)