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(); } -