From a6e1bddfffbe00b9ccbdbfde9df962163146df76 Mon Sep 17 00:00:00 2001 From: victoriaCS Date: Sun, 18 May 2025 19:48:42 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=20=D1=84=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 125747c..a61afc7 100644 --- a/main.cpp +++ b/main.cpp @@ -1,9 +1,10 @@ +#include #include #include #include "histogram.h" #include "text.h" #include "svg.h" -//#include "doctest.h" + using namespace std; struct Input { @@ -12,14 +13,15 @@ struct Input { size_t block_width{}; }; -Input input_data(istream& in_steam = cin, bool prompt = true) { +Input input_data(istream& in_stream = cin, bool prompt = true) { + Input in; size_t number_count; + if (prompt) { - cerr << "Enter number count: "; + cerr << "Enter number count: "; } - in_steam >> number_count; + in_stream >> number_count; - Input in; in.numbers.resize(number_count); if (prompt) { @@ -37,11 +39,16 @@ Input input_data(istream& in_steam = cin, bool prompt = true) { return in; } - int main() { + CURLcode res = curl_global_init(CURL_GLOBAL_ALL); + if (res != CURLE_OK) { + cerr << "cURL initialization failed: " << curl_easy_strerror(res) << endl; + return 1; + } + auto in = input_data(); auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins, in.block_width); + curl_global_cleanup(); } -