|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
@ -10,7 +11,6 @@ struct Input {
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Îáíîâëåííàÿ ôóíêöèÿ input_data
|
|
|
|
|
Input input_data(istream& in, bool prompt) {
|
|
|
|
|
size_t number_count;
|
|
|
|
|
|
|
|
|
@ -30,13 +30,78 @@ Input input_data(istream& in, bool prompt) {
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
}
|
|
|
|
|
in >> input.bin_count;
|
|
|
|
|
|
|
|
|
|
return input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
// Âûçûâàåì input_data ñ cin è óêàçàíèåì âûâîäà ïîäñêàçîê
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
|
|
|
|
|
if (argc > 1) {
|
|
|
|
|
cout << "Êîëè÷åñòâî àðãóìåíòîâ: " << argc << endl;
|
|
|
|
|
for (int i = 0; i < argc; ++i) {
|
|
|
|
|
cout << "argv[" << i << "] = " << argv[i] << endl;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
|
|
|
|
|
if (res != CURLE_OK) {
|
|
|
|
|
cerr << "curl_global_init() failed: " << curl_easy_strerror(res) << endl;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto in = input_data(cin, true);
|
|
|
|
|
|
|
|
|
|
// Ãåíåðàöèÿ ãèñòîãðàììû
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
|
|
|
|
|
// Çàâåðøåíèå ðàáîòû cURL
|
|
|
|
|
curl_global_cleanup();
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
/*#include <iostream>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "histogram.h"
|
|
|
|
|
#include "svg.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
struct Input{
|
|
|
|
|
vector<double> numbers;
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Input input_data(){
|
|
|
|
|
size_t number_count;
|
|
|
|
|
cerr<<"Enter number count:";
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
|
|
|
|
|
Input in;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
|
|
|
|
|
for(size_t i=0; i<number_count; i++){
|
|
|
|
|
cin>>in.numbers[i];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cerr<<"Enter bin count: ";
|
|
|
|
|
cin>>in.bin_count;
|
|
|
|
|
return in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|