|
|
@ -14,21 +14,23 @@ struct Input {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
Input
|
|
|
|
input_data(istream& stream) {
|
|
|
|
input_data(istream& stream, bool prompt) {
|
|
|
|
size_t number_count;
|
|
|
|
size_t number_count;
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
if (prompt) {
|
|
|
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
|
|
|
}
|
|
|
|
stream >> number_count;
|
|
|
|
stream >> number_count;
|
|
|
|
Input in;
|
|
|
|
Input in;
|
|
|
|
|
|
|
|
if (prompt) {
|
|
|
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stream >> in.bin_count;
|
|
|
|
vector<double> numbers(in.number_count);
|
|
|
|
vector<double> numbers(in.number_count);
|
|
|
|
in.numbers.resize(in.number_count);
|
|
|
|
in.numbers.resize(in.number_count);
|
|
|
|
for (size_t i = 0; i < in.number_count; i++) {
|
|
|
|
for (size_t i = 0; i < in.number_count; i++) {
|
|
|
|
stream >> in.numbers[i];
|
|
|
|
stream >> in.numbers[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t bin_count;
|
|
|
|
size_t bin_count;
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
|
|
|
stream >> in.bin_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t max_count;
|
|
|
|
size_t max_count;
|
|
|
|
in.max_count = 0;
|
|
|
|
in.max_count = 0;
|
|
|
|
return in;
|
|
|
|
return in;
|
|
|
@ -38,7 +40,8 @@ input_data(istream& stream) {
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto in = input_data(cin);
|
|
|
|
bool prompt = true;
|
|
|
|
|
|
|
|
auto in = input_data(cin, prompt);
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
|
|
|
|
vector<double> test;
|
|
|
|
vector<double> test;
|
|
|
|
show_histogram_svg(bins, in.max_count, in.bin_count, test);
|
|
|
|
show_histogram_svg(bins, in.max_count, in.bin_count, test);
|
|
|
|