#include using namespace std; #include "histogram.h" #include "text.h" #include "svg.h" struct Input { std::vector numbers; size_t bin_count{}; }; Input input_data(istream& in, bool promt); int main(int argc, char* argv[]) { if(argc > 1 ){ curl_global_init(CURL_GLOBAL_ALL); 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){ cout << curl_easy_strerror(res) << endl; exit(1); } curl_easy_cleanup(curl); } return 0; } Input in = input_data(cin,true); std::vector bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins); return 0; } Input input_data(istream& in, bool promt) { Input input_struct; size_t countOfNumbers; if(promt){cerr << "Input your count of numbers:\n";} cin >> countOfNumbers; input_struct.numbers.resize(countOfNumbers); if(promt){cerr << "Input numbers:\n";} for (int i = 0; i < countOfNumbers; i++) { if(promt){cerr << i << ":" << endl;} cin >> input_struct.numbers[i]; } if(promt){ cerr << endl; cerr << "Input bin count:\n"; } cin >> input_struct.bin_count; return input_struct; }