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

using namespace std;
int inbl()
{
    int BLOCK_WIDTH;
    cout << "block width is";
    cin>>BLOCK_WIDTH;
    if (BLOCK_WIDTH>30)
    {
        cout<< "too big, please make it smaller";
        inbl;
    }
    else if (BLOCK_WIDTH<3)
    {
        cout<< "too small, please make it bigger";
        inbl;
    }
    else return BLOCK_WIDTH;

}
struct Input
{
    vector<double> numbers;
    size_t bin_count;
    int BLOCK_WIDTH;
};
Input
input_data()
{
    size_t number_count;
    cin >> number_count;
    Input in;
    in.numbers.resize(number_count);
    for (size_t i = 0; i < number_count; i++)
    {
        cin >> in.numbers[i];
    }
    size_t bin_count;
    cin >> bin_count;
    int BLOCK_WIDTH = inbl();
    return in;
}


int main()
{
    auto in = input_data();
    auto bins = make_histogram(in.numbers, in.bin_count);
    show_histogram_svg(bins,in.BLOCK_WIDTH);


    return 0;
}
