|
|
|
@ -10,41 +10,30 @@ using namespace std;
|
|
|
|
|
struct Input {
|
|
|
|
|
vector<double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
size_t user_block_width;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
|
input_data() {
|
|
|
|
|
input_data(istream& in) {
|
|
|
|
|
Input inp;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
Input in;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
in >> number_count;
|
|
|
|
|
inp.numbers.resize(number_count);
|
|
|
|
|
cerr << "Enter numbers: " << endl;
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
in >> inp.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
in.user_block_width = 15;
|
|
|
|
|
do {
|
|
|
|
|
cerr << "Enter block width: ";
|
|
|
|
|
cin >> in.user_block_width;
|
|
|
|
|
if ((in.user_block_width < 3) || (in.user_block_width > 30)){
|
|
|
|
|
cerr << "Error: block width must be included in the interval: [3; 30]" << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while ((in.user_block_width < 3) || (in.user_block_width > 30));
|
|
|
|
|
|
|
|
|
|
return in;
|
|
|
|
|
in >> inp.bin_count;
|
|
|
|
|
return inp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
main()
|
|
|
|
|
{
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
auto in = input_data(cin);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins, in.user_block_width);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|