#include "text.h" #include "svg.h" #include #include #include "text.h" using namespace std; void show_histogram_text (const std::vector& bins, size_t MAX_ASTERISK, size_t bin_count) { double mxbins = bins[0]; for (double x : bins) { if (x > mxbins) mxbins = x; } double k; if (mxbins > MAX_ASTERISK) k = MAX_ASTERISK / mxbins; else k = 1; for (size_t i = 0; i < bin_count; i++) { if (bins[i] < 10) { cout << " " << bins[i] << "|"; } else if (bins[i] < 100) { cout << " " << bins[i] << "|"; } else if (bins[i] < 1000) { cout << bins[i] << "|"; } for (int j = 0; j < int(bins[i] * k); j++) { cout << "*"; } cout << endl; } }