#include #include #include "histogram.cpp" /* Костыль!!!!! #include "histogram.h" не работает, тем не менее, всё по методичке работает только с #include "histogram.cpp" разобраться!!!!!!!! Вынести печать в show_histogram_text(), а его в отдельный cpp и h */ using namespace std; struct Input { vector marks; int NCharts = 0; }; Input input_data() { Input in; int VecSize = 0; cin >> VecSize; in.marks.resize(VecSize); for (int i = 0; i < VecSize; i++) { cin >> in.marks[i]; } cin >> in.NCharts; return in; }; int main() { const int shift = 4, maxlen = 80; Input in = input_data(); int VecSize = size(in.marks); double interval = 0, inp = 0, i = 0, min = 0, max = 0, scale = 1; vector chart = MakeHistogram(in.marks, in.NCharts); FindMinMax(chart, min, max); if ((max+shift) > maxlen) { scale = (max+shift) / maxlen; } for (i = 0; i < in.NCharts; i++) { if (chart[i] < 10) { cout << " "; } else if (9 < chart[i] && chart[i]< 100) { cout << " "; } cout << chart[i] << "|"; max = (chart[i] / scale); if (scale != 1) { max -= 1; } for (int j = 0; j < max; j++) { cout << "*"; } cout << "\n"; } }