|
|
@ -3,6 +3,7 @@
|
|
|
|
#include "histogram.h"
|
|
|
|
#include "histogram.h"
|
|
|
|
#include "svg.h"
|
|
|
|
#include "svg.h"
|
|
|
|
#include "show_svg.h"
|
|
|
|
#include "show_svg.h"
|
|
|
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
using namespace std;
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
struct Input {
|
|
|
|
struct Input {
|
|
|
@ -13,29 +14,39 @@ struct Input {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
Input
|
|
|
|
input_data() {
|
|
|
|
input_data(istream& stream, bool prompt) {
|
|
|
|
|
|
|
|
size_t number_count;
|
|
|
|
|
|
|
|
if (prompt) {
|
|
|
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stream >> number_count;
|
|
|
|
|
|
|
|
|
|
|
|
Input in;
|
|
|
|
Input in;
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
cin >> in.number_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (prompt){
|
|
|
|
|
|
|
|
cerr << "Enter numbers: ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < number_count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
stream >> in.numbers[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vector<double> numbers(in.number_count);
|
|
|
|
if (prompt){
|
|
|
|
in.numbers.resize(in.number_count);
|
|
|
|
cerr << "Enter number of bins: ";
|
|
|
|
for (size_t i = 0; i < in.number_count; i++) {
|
|
|
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stream >> in.bin_count;
|
|
|
|
|
|
|
|
|
|
|
|
size_t bin_count;
|
|
|
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t max_count;
|
|
|
|
|
|
|
|
in.max_count = 0;
|
|
|
|
|
|
|
|
return in;
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Input in = input_data();
|
|
|
|
curl_global_init(CURL_GLOBAL_ALL);
|
|
|
|
|
|
|
|
bool prompt = true;
|
|
|
|
|
|
|
|
auto in = input_data(cin, prompt);
|
|
|
|
vector<size_t> bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
|
|
|
|
vector<size_t> bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|