count integers with array

Hello people, now I'm learning array.
I now know how to count integers with while loop
but I'm not sure how to count the integers with array.
so the question is:
1. program should keep reading integers as long as the integers are within [0,9999]
2. when user typed the integer not between 0 to 9999, the program print out the numbers of integers that were typed.

Sample
3
3
3
9999
9999
-1
You entered 3 3 times.
You entered 9999 2 times.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream> 
using namespace std; 
int main() 
{ 
    int i=-1;
    int x; 
    int numbers[10000]; 
    for(x=0; x<10000; x=x+1) 
        numbers[x] = 0;
        do{ 
            if(i != -1) 
                numbers[i]=numbers[i]+1; 
                cin >> i; 
}

    while(i>-1 && i<10000);{ 
        for(x=0; x<10000; x=x+1) { 
            if(numbers[x]) cout << "You entered " << x << " " << numbers[x] << " times.\n"; 
} 
}
return 0;
}

I cannot use "do", can you guys fix it?
Last edited on
thread already started here...
http://www.cplusplus.com/forum/beginner/126872/
Topic archived. No new replies allowed.