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

..

5 Коммитов

Автор SHA1 Сообщение Дата
0af7355eed code: обработка ошибок 2024-05-19 00:31:22 +03:00
61541cc2e0 code: загрузка файла по сети 2024-05-19 00:10:58 +03:00
42a69cd1bb code: получение аргументов 2024-05-18 22:49:45 +03:00
4936fd20bb code: libcurl-x64.dll 2024-05-18 21:55:04 +03:00
f9f6bfb835 code: bool prompt 2024-05-18 19:29:19 +03:00
2 изменённых файлов: 43 добавлений и 3 удалений

1
.gitignore поставляемый
Просмотреть файл

@@ -1,3 +1,4 @@
/bin /bin
/obj /obj
/test.layout /test.layout
/curl

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

@@ -1,3 +1,4 @@
#include <curl/curl.h>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include "histogram.h" #include "histogram.h"
@@ -14,7 +15,8 @@ struct Input {
}; };
Input Input
input_data(istream& in) { input_data(istream& in, bool prompt) {
if (prompt==true){
Input in; Input in;
cerr << "Enter number count: "; cerr << "Enter number count: ";
cin >> in.number_count; cin >> in.number_count;
@@ -32,13 +34,50 @@ input_data(istream& in) {
size_t max_count; size_t max_count;
in.max_count = 0; in.max_count = 0;
return in; return in;
}
if (prompt==false){
Input in;
cin >> in.number_count;
vector<double> numbers(in.number_count);
in.numbers.resize(in.number_count);
for (size_t i = 0; i < in.number_count; i++) {
cin >> in.numbers[i];
}
size_t bin_count;
cin >> in.bin_count;
size_t max_count;
in.max_count = 0;
return in;
}
} }
int main() int main(int argc, char* argv[])
{ {
auto in = input_data(cin); if (argc>1){
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, argv[0]);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res!=0){
cout<<res;
exit(1);
}
}
}
curl_global_init(CURL_GLOBAL_ALL);
auto in = input_data(cin, true);
auto bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count); auto bins = make_histogram(in.numbers, in.bin_count, in.number_count, in.max_count);
vector<double> test; vector<double> test;
show_histogram_svg(bins, in.max_count, in.bin_count, test); show_histogram_svg(bins, in.max_count, in.bin_count, test);