into an array. Write a function that processes the array so that any duplicate values are eliminated. Write
an output function that prints out the values of the array. You can assume that there are no more than 20
integers in the input. But there may be less. Zero signifies the end of input. The zero should NOT be
printed.
For example, when the following input is provided to your program:
5 6 22 5 22 7 6 0
your program should print:
5 6 22 7
heres what I got and I tried a few things to remove the dupes but it wouldn't even compile I cant figure it out. What I have is a program that takes in the entries and prints them out but I need some help removing the dupes. ANy help will be greatly appreciated.
Expand|Select|Wrap|Line Numbers
- #include <iostream>
- using namespace std;
- int main ()
- {
- int numbs[20], value, dupes, idx;
- cout << "Please enter in a series of numbers ending it with a 0: ";
- for(idx = 0; idx < 20; idx++) {
- cin >> value;
- if(value == 0) {
- break;
- }
- numbs[idx] = value;
- }
- int n = idx;
- for (idx = 0; idx < n; idx++)
- {
- if (numbs[idx] != 0)
- cout << numbs[idx]<< " " ;
- }
- cout << endl;
- }