the negative value not count properly. pls help.
Thank you.
#include <iostream>
using namespace std;
void main()
{
int a[10] = {1,2,2,2,3,3,-3,-2};
int f[10] = {0};
int i;
for (int i = 0; i<10 ; i++){
f[a[i]]++;
}
for (i = -2; i<10; i++){
cout << i <<" appears "<<f[i]<<" times."<<endl;
}