#include "text.h"
#include <iostream>
#include <vector>
using namespace std;

void show_histogram_text(vector<int>& ch, size_t bin_count)
{
    int m = 0, i;
    for (i = 0; i < bin_count; i++)
        if (ch[i] > m)
            m = ch[i];
    for (i = 0; i < bin_count; i++)
    {
        if (ch[i] < 10)
            cout << "  ";
        else if (ch[i] < 100)
            cout << " ";
        cout << ch[i] << "|";
        size_t k = ch[i];
        if (m > 76)
            k = 76 * (static_cast <double> (ch[i]) / m);
        for (size_t j = 0; j < k; j++)
            cout << "*";
        cout << endl;
    }
}