1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
using namespace std;
int main()
{
//declare numbers array
int numbers[5][3] = {{1, 2, 7} , {2, 5, 3}, {1, 9, 4}, {2, 6, 5}, {7, 2, 2}};
int i;
int count[10]={};
for(i=0;i<5*3;i++)
count[numbers[i%5][i/5]]++;
for(i=0;i<10;i++)
cout << i << " occurred " << count[i] << " times\n";
system("pause");
return 0;
} //end of main function
|