0136 - Frequency Distribution of Height

#include <iostream>
using namespace std;

void Slove(int n)	{
	int count[6]={0};
	double height;

	for (int i=0; i<n; ++i)	{
		cin >> height;
		if (height < 165.0)	++count[0];
		else if (height < 170.0)	++count[1];
		else if (height < 175.0)	++count[2];
		else if (height < 180.0)	++count[3];
		else if (height < 185.0)	++count[4];
		else	++count[5];
	}
	for (int i=0; i<6; ++i)	{
		cout << i+1 << ":";
		for(int j=0; j<count[i]; ++j)
			cout << "*";
		cout << endl;
	}
}

int main(void)	{
	int n;

	cin >> n;
	Slove(n);
	return 0;
}

身長で場合分けを行い、その後*で各身長の人数を表示
~了~