I think you not quite understanding something here...
this code sets HOW MANY numbers are avaliable, not the MAX VALUE of the number being input,
This Code here...
Code:
while (j < sizeOfList) {
cin >> i;
a[i]++;
j++;
}
dosn't actually input any numbers into the array; it just selects the array and goes to the next one without doing anything, you would want something more like
Code:
while (j < sizeOfList) {
cin >> a[j];
j++;
}
or even better...
Code:
for(j =0; j < sizeOfList; j++)
{
cin >> a[j];
}
notice how i is redendent in both cases.
and i'd recomend checking your output at the end of the program so you can see whats going on, add something like
Code:
for(j=0;j < sizeOfList; j++)
{
cout<< a[j] << std::endl ;
}
while(1){}
just to debug and make sure whats going in is whats going out.
in this case you dont need to preset anything to zero.
Hopefully that will help.