Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
72 строки
1.3 KiB
C++
72 строки
1.3 KiB
C++
#include <curl/curl.h>
|
|
|
|
using namespace std;
|
|
#include "histogram.h"
|
|
#include "text.h"
|
|
#include "svg.h"
|
|
|
|
|
|
struct Input {
|
|
std::vector<double> 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);
|
|
curl_easy_cleanup(curl);
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
Input in = input_data(cin,true);
|
|
std::vector<size_t> 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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|