#include "text.h"
#include <cstdio>
#include <iostream>
using namespace std;
void
show_histogram_text(vector<size_t>& bins, size_t & max_count,size_t & bin_count) {
const size_t SCREEN_WIDTH = 80;
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
if (max_count > MAX_ASTERISK){
        vector<size_t> hights(bin_count);
        for (size_t i = 0; i < bin_count; i++){
            size_t height = MAX_ASTERISK * (static_cast<double>(bins[i]) / max_count);
            hights[i] = height;
        }

        for (size_t i = 0; i < bin_count; i++){
            printf("%3d|", bins[i]);
            for (size_t j = 0; j < hights[i]; j++){
                cout<<"*";
            }
            cout << endl;
        }
    }
    else{
        for (size_t i = 0; i < bin_count; i++)
        {
            printf("%3d|", bins[i]);
            for (size_t j = 0; j < bins[i]; j++){
                cout<<"*";
            }
            cout << endl;
        }
    }

}