1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World" << endl;
int arr[100] = {0,10,11,1,2,3,2,3,0,1,2,0,7,10,15,12,11,1,2,1,3
,5,6,4,3,2,10,22,0,11,12,1,10,0,11,36,15,26,30,41,11,0,1,0,1,0,1,2,3,4,5,6,4,52
,21,5,22,36,12,10,11,25,22,1,2,2,3,4,5,6,1,2,3,4,5,6,11,20,40,50,11,33,25,178,177,178,179,17,178,178,179,156,145,140,14,15,16,17,18,19};
//print array of 100 numbesr
for(int i = 0; i < 100; i++)
{
cout << "@ " << i << " : " << arr[i] << endl;
}
int histArray[180] = {0};
//assign 0 to all histArray[180]
for(int i = 0; i < 100; i++)
{
histArray[i] = 0;
}
//calculate histogram array
for(int i = 0; i < 100; i++)
{
histArray[arr[i]]++;
}
cout << endl;
cout << "Histogram value at index..." << endl;
//calculate histogram array in range 0, 180
for(int i = 0; i < 180; i++)
{
cout << i << " : " << histArray[i] << endl;
}
//but i want to calculate histogram in this range: 90 to 180,0 to 89
return 0;
}
|