master
Varvara (ZeninaVA) 1 месяц назад
Родитель 9f5bbe976c
Сommit 85eb559f72

@ -1,12 +1,13 @@
#include <iostream>
#include <curl/curl.h> #include <curl/curl.h>
#include "histogram.h" #include "histogram.h"
#include "text.h" #include "text.h"
#include "svg.h" #include "svg.h"
#include <iostream>
#include <vector> #include <vector>
using namespace std; using namespace std;
struct Input { struct Input {
vector<double> vec; vector<double> vec;
size_t korz{}; size_t korz{};
@ -25,8 +26,9 @@ Input input_data(istream &in, bool prompt) {
if (prompt) { if (prompt) {
cerr << "Elements: "; cerr << "Elements: ";
} }
for (size_t i = 0; i < n; i++) for (size_t i = 0; i < n; i++) {
in >> data.vec[i]; in >> data.vec[i];
}
if (prompt) { if (prompt) {
cerr << "Enter bin count: "; cerr << "Enter bin count: ";
@ -36,18 +38,25 @@ Input input_data(istream &in, bool prompt) {
return data; return data;
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
curl_global_init(CURL_GLOBAL_ALL); curl_global_init(CURL_GLOBAL_ALL);
if (argc > 1) { if (argc > 1) {
cout << "argc = " << argc << endl;
for (int i = 0; i < argc; ++i) { const char *url = argv[1];
cout << "argv[" << i << "] = " << argv[i] << endl;
CURL *curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_perform(curl);
curl_easy_cleanup(curl);
} }
return 0; return 0;
} }
auto in_with_prompt = input_data(cin, true); auto in_with_prompt = input_data(cin, true);
auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec); auto bins_with_prompt = make_histogram(in_with_prompt.korz, in_with_prompt.vec);
show_histogram_svg(bins_with_prompt); show_histogram_svg(bins_with_prompt);
}
return 0;

Загрузка…
Отмена
Сохранить