hi guys can you help me i`ve made a program that removes "0" from "n" typed numbers now i have to do the same but remove the duplicate here is my program:
Hi, if you want to remove duplicates from an array then probably the easiest way is creating a new array and copying there the values that you want to keep. The problem is "how large must the new array be?" The answer is N, where N is the number of different values in your original array. So how to count them? Well this could be a bit tricky... An easy way is to sort all of your elements in ascending (or descending) order, so that all the duplicates are one next to the other.
Try it and let us know.
P.S. It would be so much easier with vectors instead of arrays!