|
|
|
@ -5,30 +5,36 @@
|
|
|
|
|
#include "text.h"
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
|
|
|
|
|
struct Input {
|
|
|
|
|
struct Input
|
|
|
|
|
{
|
|
|
|
|
std::vector<double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input input_data(std::istream& in, bool prompt) {
|
|
|
|
|
Input input_data(std::istream& in, bool prompt)
|
|
|
|
|
{
|
|
|
|
|
Input data;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
|
|
|
|
|
if(prompt){
|
|
|
|
|
if(prompt)
|
|
|
|
|
{
|
|
|
|
|
cerr << "Enter the number of elements: ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
in >> number_count;
|
|
|
|
|
data.numbers.resize(number_count);
|
|
|
|
|
|
|
|
|
|
if(prompt){
|
|
|
|
|
if(prompt)
|
|
|
|
|
{
|
|
|
|
|
cerr << "\nEnter " << number_count << " elements:" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
for (size_t i = 0; i < number_count; i++)
|
|
|
|
|
{
|
|
|
|
|
in >> data.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
if(prompt){
|
|
|
|
|
if(prompt)
|
|
|
|
|
{
|
|
|
|
|
cerr << "Enter the number of bins: ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -44,13 +50,17 @@ int main(int argc, char* argv[])
|
|
|
|
|
|
|
|
|
|
if (argc > 1)
|
|
|
|
|
{
|
|
|
|
|
cout << "argc = " << argc << endl;
|
|
|
|
|
for (int i = 0; i < argc; ++i)
|
|
|
|
|
const char *url = argv[1];
|
|
|
|
|
|
|
|
|
|
CURL *curl = curl_easy_init();
|
|
|
|
|
if (curl)
|
|
|
|
|
{
|
|
|
|
|
cout << "argv[" << i << "] = " << argv[i] << endl;
|
|
|
|
|
}
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_URL, url);
|
|
|
|
|
curl_easy_perform(curl);
|
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto in = input_data(cin,true);
|
|
|
|
|
auto bins = make_histogram(in.bin_count, in.numbers);
|
|
|
|
|