You are giving the entered inputs to every place in the array with the first for. Which means
userVals[i]
is the place where you are saving the info.
To know if the entered numbers are bigger than 21, you have to compare them (logically) and you know where they are saved. Don't you? At the end, a position of the array can be considered as the variable you are asking in that moment.
I mean, in the concept of comparison there is no difference with
int a = 1;
if (a > 0)
int a = 1
int b = 2
if (a > b)
in conclusion...
for (i = 0; i <= NUM_ELEMENTS; ++i) {
if (userVals[i] > 21) cout << endl << userVals[i] << endl;
}