код возвращен к изначальному виду
Этот коммит содержится в:
44
main.cpp
44
main.cpp
@@ -41,20 +41,52 @@ int main()
|
|||||||
bins[bin_count-1]++;
|
bins[bin_count-1]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < number_count; i++)
|
size_t Maxbins = 0;
|
||||||
|
for (size_t i = 0; i < bin_count; i++)
|
||||||
{
|
{
|
||||||
for (size_t j = 0; j < bin_count; j++)
|
if (bins[i] > Maxbins)
|
||||||
{
|
{
|
||||||
if (bins[j]> i)
|
Maxbins = bins[i];
|
||||||
{
|
|
||||||
cout << "*";
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
const size_t MAX_HEIGHT = 76;
|
||||||
|
if (Maxbins <= MAX_HEIGHT)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < bin_count; i++)
|
||||||
|
{
|
||||||
|
if (bins[i] < 10)
|
||||||
{
|
{
|
||||||
cout << " ";
|
cout << " ";
|
||||||
}
|
}
|
||||||
|
cout << " " << bins[i]<< "|";
|
||||||
|
for (size_t j = 0; j < bins[i]; j++)
|
||||||
|
{
|
||||||
|
cout << "*";
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < bin_count; i++)
|
||||||
|
{
|
||||||
|
size_t height = static_cast<size_t>(MAX_HEIGHT * (static_cast<double>(bins[i]) / Maxbins));
|
||||||
|
|
||||||
|
if (bins[i] < 100)
|
||||||
|
{
|
||||||
|
cout << " ";
|
||||||
|
}
|
||||||
|
if (bins[i] < 10)
|
||||||
|
{
|
||||||
|
cout << " ";
|
||||||
|
}
|
||||||
|
cout << bins[i] << "|";
|
||||||
|
for (size_t j = 0; j < height; j++)
|
||||||
|
{
|
||||||
|
cout << "*";
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user