diff --git a/main.cpp b/main.cpp index a4d8004..7670f2a 100644 --- a/main.cpp +++ b/main.cpp @@ -19,7 +19,8 @@ Input input_data(istream& inp, bool prompt) Input in; size_t number_count; - if(prompt){ + if(prompt) + { cerr << "Enter number_count: "; } inp >> number_count; @@ -31,24 +32,42 @@ Input input_data(istream& inp, bool prompt) inp >> in.numbers[i]; } - if(prompt){ + if(prompt) + { cerr << "Enter bin_count: "; } inp >> in.bin_count; in.colors.resize(in.bin_count); cerr << "Enter colors: "; - for (size_t i = 0; i < in.bin_count; i++) { + for (size_t i = 0; i < in.bin_count; i++) + { inp >> in.colors[i]; } return in; } -int main() +int main(int argc, char* argv[]) { + 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); + } + return 0; + } + curl_global_init(CURL_GLOBAL_ALL); + auto in = input_data(cin, true); auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins, in.colors); + return 0; }