#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; } }