Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
43 строки
861 B
C++
43 строки
861 B
C++
#include "text.h"
|
|
#include "svg.h"
|
|
#include <string>
|
|
#include <iostream>
|
|
#include "text.h"
|
|
using namespace std;
|
|
|
|
void show_histogram_text (const std::vector<double>& 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;
|
|
}
|
|
}
|