Алёна Аулова 2 лет назад
Родитель b9aa3c81d4
Сommit f7b44c17a2

@ -0,0 +1,67 @@
#include <iostream>
#include <vector>
#include "text.h"
using namespace std;
void
show_histogram_text(vector<size_t> bins, size_t bin_count)
{
size_t max_count=0;
for (size_t i =0; i<bin_count; i++)
{
if (max_count <bins[i])
{
max_count=bins[i];
}
}
float procent;
for(size_t i=0; i<bin_count; i++)
{
int procent =(float)bins[i];
if (procent<10)
{
cout<<" "<<procent<<" | ";
}
if ((procent<100)&&(procent>=10))
{
cout<<" "<<procent<<" | ";
}
size_t height = 0;
if (max_count>76)
{
size_t height = 76 * (static_cast<double>(bins[i]) / max_count);
for(size_t j=0; j<=height; j++)
{
cout<<"*";
}
}
else
{
for(size_t j=0; j<=bins[i]-1; j++)
{
cout<<"*";
}
}
cout<<endl;
}
return;
}
Загрузка…
Отмена
Сохранить