### Array HW problem is buggy

"Use a one-dimensional array to solve the following problem. Read in 30 numbers, each of which is between 10 and 100, inclusive, As each m=number is read, validate it and store it int the array only if it isn't a duplicate of a number already read. After reading all the values, display only the unique values that the user entered. Provide for the 'worst case' in which all 20 numbers are different. Use the smallest possible array to solve the problem."

It outputs junk, when I want it to output the non-zero table contents.

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647`` ``````#include using namespace std; int main() { const int arraySize = 19; int n = -1, a[ arraySize ] = {}, prompt(), linearSearch( const int [], int, int ); //Declare variables, array, and function prototypes for ( int counter = 1; counter <= arraySize; counter++ ) // Input numbers { n = prompt(); if ( linearSearch( a, n, arraySize ) !=-1 ) // Only store if parameters are met a[ counter ] = n; } cout << "Unique and valid values you entered:" << endl; for ( int counter2 = 0; counter2 <= arraySize; counter2++ ) { if ( a[ counter2 ] != 0 ) // Only print element value if non-zero cout << a[ counter2 ] << "\t"; } cout << endl << endl; system("pause"); } int prompt () { int x = 0; do { cout << "Please enter an integer no greater than 100 and no less than 10. \t"; cin >> x; cout << endl; } while ( x <=10 || x >= 100 ); return x; } int linearSearch( const int array[], int key, int size_of_array ) // I copied this right out of the book. { for ( int counter3 = 0; counter3 < size_of_array; counter3++ ) if ( array[ counter3 ] == key ) return counter3; return -1; }``````

Thank you.
The problem statement is faulty. The first line says read in 30 numbers.
The last line states all 20 numbers can be different. Which is it 20 or 30?