|
|
|
@ -5,7 +5,7 @@
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include <text.h>
|
|
|
|
|
#include <svg.h>
|
|
|
|
|
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
@ -20,29 +20,67 @@ struct Input {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
|
input_data() {
|
|
|
|
|
input_data(istream& in, bool prompt) {
|
|
|
|
|
if (prompt == true) {
|
|
|
|
|
size_t number_count;
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
Input in;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
cerr << "amount of numbers";
|
|
|
|
|
in >> number_count;
|
|
|
|
|
Input inn;
|
|
|
|
|
inn.numbers.resize(number_count);
|
|
|
|
|
vector<double> numbers(number_count);
|
|
|
|
|
cerr << "input numbers";
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
in >> inn.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t bin_count;
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
return in;
|
|
|
|
|
cerr << "amount of baskets";
|
|
|
|
|
in >> inn.bin_count;
|
|
|
|
|
return inn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (prompt == false) {
|
|
|
|
|
size_t number_count;
|
|
|
|
|
cout << "amount of numbers";
|
|
|
|
|
in >> number_count;
|
|
|
|
|
Input inn;
|
|
|
|
|
inn.numbers.resize(number_count);
|
|
|
|
|
vector<double> numbers(number_count);
|
|
|
|
|
cout << "input numbers";
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
in >> inn.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t bin_count;
|
|
|
|
|
cout << "input baskets";
|
|
|
|
|
in >> inn.bin_count;
|
|
|
|
|
return inn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
auto procent = make_histogram_proc(in.numbers, in.bin_count, bins);
|
|
|
|
|
|
|
|
|
|
CURL *curl = curl_easy_init();
|
|
|
|
|
if(curl) {
|
|
|
|
|
CURLcode res;
|
|
|
|
|
curl_easy_setopt(curl, CURLOPT_URL, "http://uit.mpei.ru/study/courses/cs/lab03/marks.txt");
|
|
|
|
|
res = curl_easy_perform(curl);
|
|
|
|
|
curl_easy_cleanup(curl);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool flag;
|
|
|
|
|
bool prompt;
|
|
|
|
|
prompt = true;
|
|
|
|
|
auto inn = input_data(cin, prompt);
|
|
|
|
|
auto bins = make_histogram(inn.numbers, inn.bin_count, flag);
|
|
|
|
|
auto procent = make_histogram_proc(inn.numbers, inn.bin_count, bins);
|
|
|
|
|
show_histogram_svg(bins, procent);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|