From 36c130b720222dc216235976692fcc674664b53e Mon Sep 17 00:00:00 2001 From: KnyazevSK Date: Sun, 4 Jun 2023 23:35:41 +0400 Subject: [PATCH] =?UTF-8?q?code:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE?= =?UTF-8?q?=D0=BA,=20=D1=87=D0=B8=D1=81=D1=82=D0=BE=D0=B2=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B2=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/main.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/project/main.cpp b/project/main.cpp index 55262cd..5cb2988 100644 --- a/project/main.cpp +++ b/project/main.cpp @@ -73,27 +73,15 @@ download(const string& address) int main(int argc, char* argv[]) { + Input input; 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); - if (res != CURLE_OK) - { - cout << curl_easy_strerror; - exit(1); - } - } - return 0; + input = download(argv[1]); + } + else + { + input = input_data(cin, true); } - curl_global_init(CURL_GLOBAL_ALL); - auto in = input_data(cin, true); - auto bins = make_histogram(in.numbers, in.bin_count); + const auto bins = make_histogram(input.numbers, input.bin_count); show_histogram_svg(bins); - getch(); - return 0; }