So I'm supposed to display the values entered by the user as well as the frequency of those numbers and I'm not so sure where to start. Can anyone help me out?
int main() {
constint SIZE = 100;
int y[SIZE] = {};
int dup[SIZE] = {};
for (int i = 0; i <=100;++i){
cout << "Enter a value between 1-100 (Press -99 to stop): " << endl;
cin >> y[i];
if (y[i] == -99)
break;
}
cout << "The values entered are: " << endl;
for (int i = 0; i < y[i];++i)
cout<<y[i] << endl;
return 0;
}
It’s a good start, but your question is very vague. Usually people here ask about specific problem. You’d better try by your own and, if you get some error, ask again.
reusing the i is causing you problems here, i'll reproduce your code with the i's renamed and hopefully it will put you back on course.... Also note the fix in the end criteria for the second for loop.