I've been refreshing myself on arrays for once classes start. So for this I am given code and I need to be able to find duplicates in the user input. Any Solutions?
Ex: How it is: The numbers in reverse order is: 5 2 7 6 5 3 9
How it should be: The numbers in reverse order is: 2 7 6 5 3 9
note: The numbers are in reverse.
#include <iostream>
using namespace std;
const int ARRAY_SIZE = 1000;
int main()
{
int count;
int number;
int numItems;
int list[ARRAY_SIZE];
count = 0;
cout << "Enter a number (negative number to quit): ";
cin >> number;
while (number >= 0){
list[count] = number;
count++;
cout << "Enter a number (negative number to quit): ";
cin >> number;
}
numItems = count;
cout << "The numbers in reverse order is: ";
for (count = numItems - 1; count >= 0; count--){
cout << list[count] << " ";
}
}