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
|
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
const int size1=40;
const int size2=11;
const int array[size1]={1,2,6,4,8,5,9,7,8,10,1,6,3,8,6,10,3,8,2,7,6,5,7,6,8,6,7,5,6,6,5,6,7,5,6,4,8,6,8,10};
int array1[size2];
for (int i = 0; i<size1; i++){
array1[array[i]]++;
}
cout<<"rating"<<setw(20)<<"freq"<<endl;
for (int r=1; r<size2; r++){
cout<<setw(9)<<r<<setw(20)<<array1[r]<<endl;
}
cin.get();
cin.get();
return 0;
}
|