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); + + +}*/ +