|
|
|
@ -11,16 +11,19 @@ struct Input {
|
|
|
|
|
vector<double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
Input input_data(istream& in) {
|
|
|
|
|
Input input_data(istream& in, bool prompt) {
|
|
|
|
|
if (prompt) cerr << "Enter number count: ";
|
|
|
|
|
size_t number_count;
|
|
|
|
|
in >> number_count;
|
|
|
|
|
|
|
|
|
|
Input data;
|
|
|
|
|
data.numbers.resize(number_count);
|
|
|
|
|
if (prompt) cerr << "Enter " << number_count << " numbers: ";
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
in >> data.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prompt) cerr << "Enter bin count: ";
|
|
|
|
|
in >> data.bin_count;
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
@ -29,8 +32,9 @@ Input input_data(istream& in) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
auto in = input_data(cin);
|
|
|
|
|
auto in = input_data(cin, true);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
show_histogram_text(bins);
|
|
|
|
|