|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <vector>
|
|
|
|
#include "histogram.h"
|
|
|
|
#include "histogram.h"
|
|
|
@ -14,7 +15,8 @@ struct Input {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
Input
|
|
|
|
input_data(istream& in) {
|
|
|
|
input_data(istream& in, bool prompt) {
|
|
|
|
|
|
|
|
if (prompt==true){
|
|
|
|
Input in;
|
|
|
|
Input in;
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
cin >> in.number_count;
|
|
|
|
cin >> in.number_count;
|
|
|
@ -32,13 +34,50 @@ input_data(istream& in) {
|
|
|
|
size_t max_count;
|
|
|
|
size_t max_count;
|
|
|
|
in.max_count = 0;
|
|
|
|
in.max_count = 0;
|
|
|
|
return in;
|
|
|
|
return in;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (prompt==false){
|
|
|
|
|
|
|
|
Input in;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cin >> in.number_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vector<double> numbers(in.number_count);
|
|
|
|
|
|
|
|
in.numbers.resize(in.number_count);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < in.number_count; i++) {
|
|
|
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t bin_count;
|
|
|
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t max_count;
|
|
|
|
|
|
|
|
in.max_count = 0;
|
|
|
|
|
|
|
|
return in;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
auto in = input_data(cin);
|
|
|
|
if (argc>1){
|
|
|
|
|
|
|
|
CURL *curl = curl_easy_init();
|
|
|
|
|
|
|
|
if(curl) {
|
|
|
|
|
|
|
|
CURLcode res;
|
|
|
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_URL, argv[0]);
|
|
|
|
|
|
|
|
res = curl_easy_perform(curl);
|
|
|
|
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
|
|
|
|
if (res!=0){
|
|
|
|
|
|
|
|
cout<<res;
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curl_global_init(CURL_GLOBAL_ALL);
|
|
|
|
|
|
|
|
auto in = input_data(cin, true);
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
|
|
|
|
vector<double> test;
|
|
|
|
vector<double> test;
|
|
|
|
show_histogram_svg(bins, in.max_count, in.bin_count, test);
|
|
|
|
show_histogram_svg(bins, in.max_count, in.bin_count, test);
|
|
|
|