From b766e3883acbcaacffd965ce49a7713a715096f7 Mon Sep 17 00:00:00 2001 From: StepanovaKY Date: Mon, 19 May 2025 16:21:28 +0300 Subject: [PATCH] =?UTF-8?q?code:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=B0=D1=80=D0=B3=D1=83=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 8016909..5f965b8 100644 --- a/main.cpp +++ b/main.cpp @@ -2,6 +2,7 @@ #include #include "histogram.h" #include "svg.h" +#include using namespace std; @@ -10,7 +11,6 @@ struct Input { size_t bin_count{}; }; -// Обновленная функция input_data Input input_data(istream& in, bool prompt) { size_t number_count; @@ -30,13 +30,78 @@ Input input_data(istream& in, bool prompt) { cerr << "Enter bin count: "; } in >> input.bin_count; - return input; } -int main() { - // Вызываем input_data с cin и указанием вывода подсказок +int main(int argc, char* argv[]) { + + if (argc > 1) { + cout << "Количество аргументов: " << argc << endl; + for (int i = 0; i < argc; ++i) { + cout << "argv[" << i << "] = " << argv[i] << endl; + } + return 0; + } + + + CURLcode res = curl_global_init(CURL_GLOBAL_ALL); + if (res != CURLE_OK) { + cerr << "curl_global_init() failed: " << curl_easy_strerror(res) << endl; + return 1; + } + + auto in = input_data(cin, true); + + // Генерация гистограммы auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins); + + // Завершение работы cURL + curl_global_cleanup(); + + return 0; } +/*#include +#include +#include "histogram.h" +#include "svg.h" + +using namespace std; + +struct Input{ + vector numbers; + size_t bin_count{}; + +}; + + +Input input_data(){ + size_t number_count; + cerr<<"Enter number count:"; + cin >> number_count; + + Input in; + in.numbers.resize(number_count); + + for(size_t i=0; i>in.numbers[i]; + + } + + cerr<<"Enter bin count: "; + cin>>in.bin_count; + return in; +} + + + +int main(){ + + auto in = input_data(); + auto bins = make_histogram(in.numbers, in.bin_count); + show_histogram_svg(bins); + + +}*/ +