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

#include <curl/curl.h>


using namespace std;

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

Input input_data(istream& stream) {
    Input in;
    size_t number_count;
    stream >> number_count;
    in.numbers.resize(number_count);
    for (size_t i = 0; i < number_count; i++) {
        stream >> in.numbers[i];
    }
    stream >> in.bin_count;
    return in;
}

int main(int argc, char* argv[]) {
    if (argc > 1) {
            for (int x = 0; x > argc; x++) {
                cout << "argv[" << x << "] = " << argv[x];
            }
            return 0;
    }
    Input in = input_data(cin);
    auto bins = make_histogram(in.numbers, in.bin_count);
    show_histogram_svg(bins);
    return 0;
}