code: файл реализации2

master
lab01(PokhilAA) 12 месяцев назад
Родитель f320b8a27d
Сommit 0345f44bfc

@ -0,0 +1,34 @@
#include "text.h"
#include <iostream>
using namespace std;
void
show_histogram_text (const vector<double>& bins,size_t MAX_ASTERISK, size_t bin_count){
size_t bin_max = 0;
size_t height = 0;
for (double x : bins)
{
if (x > bin_max){
bin_max = x;
}
}
for (size_t bin: bins)
{
size_t height = bin;
height = MAX_ASTERISK * (static_cast<double>(bin) / bin_max);
if (bin < 100)
{
cout << " ";
}
if (bin < 10)
{
cout << " ";
}
cout << bin << "|";
for (size_t i = 0; i < height; i++)
{
cout << "*";
}
cout << endl;
}
}
Загрузка…
Отмена
Сохранить