#include <iostream> #include <curl/curl.h> #include "histogram.h" #include "text.h" #include "svg.h" #include <vector> using namespace std; struct Input { vector<double> vec; size_t korz{}; }; Input input_data(istream &in, bool prompt) { Input data; size_t n, korz; if (prompt) { cerr << "Number of elements: "; } in >> n; data.vec.resize(n); if (prompt) { cerr << "Elements: "; } for (size_t i = 0; i < n; i++) { in >> data.vec[i]; } if (prompt) { cerr << "Enter bin count: "; } in >> korz; data.korz = korz; return data; } int main(int argc, char* argv[]) { curl_global_init(CURL_GLOBAL_ALL); if (argc > 1) { const char *url = argv[1]; CURL *curl = curl_easy_init(); if (curl) { curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_perform(curl); curl_easy_cleanup(curl); } return 0; } auto in_with_prompt = input_data(cin, true); auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec); show_histogram_svg(bins_with_prompt); return 0;