|
|
|
@ -3,33 +3,35 @@
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include "text.h"
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
|
|
|
|
|
struct Input {
|
|
|
|
|
vector<double> numbers;
|
|
|
|
|
std::vector<double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input input_data() {
|
|
|
|
|
Input in;
|
|
|
|
|
Input input_data(std::istream& in) {
|
|
|
|
|
Input data;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
|
|
|
|
|
cerr << "Enter the number of elements: ";
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
in >> number_count;
|
|
|
|
|
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
data.numbers.resize(number_count);
|
|
|
|
|
|
|
|
|
|
cerr << "\nEnter " << number_count << " elements:" << endl;
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
in >> data.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cerr << "Enter the number of bins: ";
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
in >> data.bin_count;
|
|
|
|
|
|
|
|
|
|
return in;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
using namespace std;
|
|
|
|
|
auto in = input_data(cin);
|
|
|
|
|
auto bins = make_histogram(in.bin_count, in.numbers);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
return 0;
|
|
|
|
|