|
|
|
@ -13,16 +13,19 @@ struct Input {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
|
input_data(istream& in) {
|
|
|
|
|
input_data(istream& in, bool prompt) {
|
|
|
|
|
Input local;
|
|
|
|
|
|
|
|
|
|
size_t number_count;
|
|
|
|
|
size_t bin_count;
|
|
|
|
|
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
}
|
|
|
|
|
in >> local.number_count;
|
|
|
|
|
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
}
|
|
|
|
|
in >> local.bin_count;
|
|
|
|
|
|
|
|
|
|
local.numbers.resize(local.number_count);
|
|
|
|
@ -39,7 +42,7 @@ int main() {
|
|
|
|
|
std::string fill = "red";
|
|
|
|
|
std::string stroke = "#000000";
|
|
|
|
|
|
|
|
|
|
auto in = input_data(cin);
|
|
|
|
|
auto in = input_data(cin, true);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins, fill, stroke);
|
|
|
|
|
return 0;
|
|
|
|
|