#include <iostream>
#include <vector>
#include "histogram.h"
#include "text.h"

struct Input {
    std::vector<double> numbers;
    size_t bin_count{};
};

Input input_data() {
    Input in;
    size_t number_count;

    std::cerr << "Enter the number of elements: ";
    std::cin >> number_count;

    in.numbers.resize(number_count);

    std::cerr << "\nEnter " << number_count << " elements:" << std::endl;
    for (size_t i = 0; i < number_count; i++) {
        std::cin >> in.numbers[i];
    }

    std::cerr << "Enter the number of bins: ";
    std::cin >> in.bin_count;

    return in;
}

int main() {
    auto in = input_data();
    auto bins = make_histogram(in.bin_count, in.numbers);
    show_histogram(bins);
    return 0;
}
