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

47 строки
840 B
C++

#include <iostream>
#include <vector>
#include "histogram.h"
#include "text.h"
#include "svg.h"
using namespace std;
struct Input {
std::vector<double> numbers;
size_t bin_count{};
size_t number_count{};
};
Input
input_data(istream& in) {
Input local;
size_t number_count;
size_t bin_count;
cerr << "Enter number count: ";
in >> local.number_count;
cerr << "Enter bin count: ";
in >> local.bin_count;
local.numbers.resize(local.number_count);
for (size_t i = 0; i < local.number_count; i++) {
in >> local.numbers[i];
}
return local;
};
int main() {
std::string fill = "red";
std::string stroke = "#000000";
auto in = input_data(cin);
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins, fill, stroke);
return 0;
}