|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include "histogram_internal.h"
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
#include "text.h"
|
|
|
|
|
#include <string>
|
|
|
|
@ -13,35 +12,24 @@ struct Input {
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input input_data() {
|
|
|
|
|
size_t number_count;
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
|
|
|
|
|
Input input_data(istream& in_stream) {
|
|
|
|
|
Input in;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
in_stream >> number_count;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
cerr << "Enter " << number_count << " numbers: ";
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
in_stream >> in.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
|
|
|
|
|
in_stream >> in.bin_count;
|
|
|
|
|
return in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
|
|
|
|
|
double min_val, max_val;
|
|
|
|
|
find_minmax(in.numbers, min_val, max_val);
|
|
|
|
|
|
|
|
|
|
double bin_size = compute_bin_size(in.numbers, in.bin_count);
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
auto in = input_data(cin);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
|
|
|
|
|
show_histogram_svg(bins, bin_size, min_val);
|
|
|
|
|
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
show_histogram_text(bins);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|