#include #include #include #include "histogram.h" #include "text.h" #include "svg.h" #include using namespace std; struct Input { vector numbers; size_t bin_count{}; }; Input input_data(istream& in_stream, bool prompt) { Input in; size_t number_count; if (prompt) { cerr << "Введите количество значений"; } in_stream >> number_count; in.numbers.resize(number_count); if (prompt) { cerr << "Введите значения"; } for (size_t i = 0; i < number_count; i++) { in_stream >> in.numbers[i]; } if (prompt) { cerr << "Введите количество столбцов гистограммы"; } in_stream >> in.bin_count; return in; } 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); if (res != 0) { cerr << curl_easy_strerror(res); exit(1); } } curl_easy_cleanup(curl); return 0; } curl_global_init(CURL_GLOBAL_ALL); const size_t SCREEN_WIDTH = 80; const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; auto in = input_data(cin, false); vector numbers_data = in.numbers; auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins, in.numbers, in.bin_count); return 0; }