Сравнить коммиты

..

2 Коммитов

Автор SHA1 Сообщение Дата
victoriaCS
85277aaf0c code: добавление prompt 2025-09-17 22:22:49 +03:00
victoriaCS
689ac0417f code: изменение input_data() 2025-09-17 22:15:28 +03:00

Просмотреть файл

@@ -1,29 +1,40 @@
#include <curl/curl.h>
#define CURL_STATICLIB
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "histogram.h"
#include "text.h"
#include "svg.h" #include "svg.h"
#include "hictogram.h"
int main(int argc, char* argv[]) { using namespace std;
if (argc > 1) {
cout << "argc = " << argc << endl; struct Input {
for (int i = 0; i < argc; ++i) { vector<double> numbers;
cout << "argv[" << i << "] = \"" << argv[i] << "\"" << endl; size_t bin_count{};
} };
return 0;
Input input_data(istream& in, bool prompt) {
size_t number_count;
if (prompt){
cerr << "Enter number count: "
}
in >> number_count;
Input in_data;
in_data.numbers.resize(number_count);
for (size_t i = 0; i < number_count; i++) {
in >> in_data.numbers[i];
} }
CURLcode res = curl_global_init(CURL_GLOBAL_ALL); if (prompt){
if (res != CURLE_OK) { cer << "Enter bin count: "
cerr << "cURL initialization failed: " << curl_easy_strerror(res) << endl;
return 1;
} }
in >> in_data.bin_count;
auto in = input_data(); return in_data;
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins, in.block_width);
curl_global_cleanup();
} }
int main() {
auto in = input_data(cin, true);
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins);
}