Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

64 строки
1.2 KiB
C++

#include <iostream>
#include <curl/curl.h>
#include <vector>
#include "histogram.h"
#include "text.h"
#include "svg.h"
using namespace std;
struct Input {
std::vector<double> numbers;
size_t bin_count{};
size_t number_count{};
};
Input
input_data(istream& in, bool prompt) {
Input local;
size_t number_count;
size_t bin_count;
if (prompt) {
cerr << "Enter number count: ";
}
in >> local.number_count;
if (prompt) {
cerr << "Enter bin count: ";
}
in >> local.bin_count;
local.numbers.resize(local.number_count);
for (size_t i = 0; i < local.number_count; i++) {
in >> local.numbers[i];
}
return local;
};
int main(int argc, char* argv[]) {
std::string fill = "red";
std::string stroke = "#000000";
curl_global_init(CURL_GLOBAL_ALL);
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;
}
auto in = input_data(cin, true);
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins, fill, stroke);
return 0;
}