|
|
|
@ -11,23 +11,30 @@ struct Input {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
Input
|
|
|
|
|
input_data(istream& stream) {
|
|
|
|
|
Input in;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
input_data(istream& stream, bool prompt) {
|
|
|
|
|
Input in;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
stream >> number_count;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
stream >> in.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
stream >> number_count;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter number " << i+1 << ": ";
|
|
|
|
|
}
|
|
|
|
|
stream >> in.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
stream >> in.bin_count;
|
|
|
|
|
return in;
|
|
|
|
|
}
|
|
|
|
|
stream >> in.bin_count;
|
|
|
|
|
return in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
main() {
|
|
|
|
|
Input in = input_data(cin);
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
Input in = input_data(cin, false);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
|
|
|
|
|