From 18cbd9abdd5a22ea64011374d463750cbb511b70 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 2 Jun 2024 21:09:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=BF=D0=BE=20=D1=81?= =?UTF-8?q?=D0=B5=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index a4d8004..7670f2a 100644 --- a/main.cpp +++ b/main.cpp @@ -19,7 +19,8 @@ Input input_data(istream& inp, bool prompt) Input in; size_t number_count; - if(prompt){ + if(prompt) + { cerr << "Enter number_count: "; } inp >> number_count; @@ -31,24 +32,42 @@ Input input_data(istream& inp, bool prompt) inp >> in.numbers[i]; } - if(prompt){ + if(prompt) + { cerr << "Enter bin_count: "; } inp >> in.bin_count; in.colors.resize(in.bin_count); cerr << "Enter colors: "; - for (size_t i = 0; i < in.bin_count; i++) { + for (size_t i = 0; i < in.bin_count; i++) + { inp >> in.colors[i]; } return in; } -int main() +int main(int argc, char* argv[]) { + if (argc > 1) + { + CURL* curl = curl_easy_init(); + + if(curl) + { + CURLcode res; + curl_easy_setopt(curl, CURLOPT_URL, argv[1]); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + } + return 0; + } + curl_global_init(CURL_GLOBAL_ALL); + auto in = input_data(cin, true); auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins, in.colors); + return 0; }