Displaying a certain element among inputted numbers I prompt the user for 9 numbers, store those numbers in 9 pointers and display the element 2. It seem to work just fine, but am I forgetting something? Can I improve it but keep it simple? I'm just a beginner testing what I have learned so far.

int n;
int *array[9];
bool isUsed[10] = {0};

for(int i = 0; i &lt; 9; i++) 
{
    cout &lt;&lt; "Enter Number " &lt;&lt; (i + 1) &lt;&lt; endl;
    cin &gt;&gt; n;
    if((n &gt;= 0) &amp;&amp; (n &lt;= 9))
    {
        if (isUsed[n] == false)
        {
            array[i] = new int;
            *array[i] = n;
            isUsed[n] = true;
        }

        else
        {
            cout &lt;&lt; "Number has already been used." &lt;&lt; endl;
            i--;
        }
    }

    else 
    {
        cout &lt;&lt; "Numbers from 0-9 only." &lt;&lt; endl;
        i--;
    }

}

    cout &lt;&lt; *array[2]&lt;&lt;endl;
You can definitely improve it, by replacing the array of pointers with a std::vector&lt;int&gt;.

If you must track usage, I suggest using a map instead, where the keys are 0...9 and the values exist only if the respective index was added.