|
|
|
@ -2,17 +2,17 @@
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include "text.h"
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
|
|
struct Input{
|
|
|
|
|
std::vector<double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input input_data(istream& in, bool prompt) {
|
|
|
|
|
Input input_data(std::istream& in, bool prompt) {
|
|
|
|
|
size_t number_count;
|
|
|
|
|
if (prompt){
|
|
|
|
|
|
|
|
|
|
if (prompt) {
|
|
|
|
|
std::cerr << "Enter number count: ";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
in >> number_count;
|
|
|
|
|
|
|
|
|
@ -20,14 +20,13 @@ Input input_data(istream& in, bool prompt) {
|
|
|
|
|
std::cerr << "Enter numbers: \n";
|
|
|
|
|
}
|
|
|
|
|
Input local;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
local.numbers.resize(number_count);
|
|
|
|
|
for (size_t i = 0; i < number_count; ++i) {
|
|
|
|
|
in >> local.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
if (prompt) {
|
|
|
|
|
std::cerr << "Enter bucket: ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
in >> local.bin_count;
|
|
|
|
|
|
|
|
|
|
return local;
|
|
|
|
@ -36,6 +35,7 @@ Input input_data(istream& in, bool prompt) {
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
curl_global_init(CURL_GLOBAL_ALL);
|
|
|
|
|
Input in = input_data(cin, true);
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|