Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

40 строки
844 B
C++

#include <iostream>
#include <vector>
#include "text.h"
#include "histogram.h"
#include "svg.h"
using namespace std;
struct Input {
std::vector<double> numbers;
size_t number_count{};
size_t bin_count{};
};
Input
input_data() {
size_t number_count;
Input in;
cin >> number_count;
in.numbers.resize(number_count);
for (size_t i = 0; i < number_count; i++) {
cin >> in.numbers[i];
}
size_t bin_count;
cin >> in.bin_count;
return in;
}
int main()
{
auto in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count);
auto max_count=bins[0];
for(size_t x : bins){
if (x > max_count)
{
max_count=x;
}
}
show_histogram_text(bins,in.bin_count,in.numbers,max_count);
//show_histogram_svg(bins, max_count);
return 0;
}