#include "text.h"
#include <vector>
#include <iostream>

using namespace std;
void show_histogram_text(vector<size_t>B, size_t kol_kor)
{

    const size_t SCREEN_WIDTH = 80;
    const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
    int max_count, count,j, height;
    for (size_t i=0; i<kol_kor; i++)
    {
        if (B[i]<10)
        {
            cout<<"  ";
        }
        else if (B[i]<100)
        {
            cout<<" ";
        }
        cout<<B[i]<<"|";
        if (max_count > MAX_ASTERISK)
        {
            count = B[i];
            height = MAX_ASTERISK * (static_cast<double>(count) / max_count);
        }

        else
        {
            height = B[i];
        }

        for (j = 0; j < height; j++)
        {
            cout << "*";
        }
        cout << endl;
    }
    return;
}