Сравнить коммиты
5 Коммитов
4f40624f31
...
0af7355eed
| Автор | SHA1 | Дата | |
|---|---|---|---|
| 0af7355eed | |||
| 61541cc2e0 | |||
| 42a69cd1bb | |||
| 4936fd20bb | |||
| f9f6bfb835 |
1
.gitignore
поставляемый
1
.gitignore
поставляемый
@@ -1,3 +1,4 @@
|
||||
/bin
|
||||
/obj
|
||||
/test.layout
|
||||
/curl
|
||||
|
||||
45
main.cpp
45
main.cpp
@@ -1,3 +1,4 @@
|
||||
#include <curl/curl.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "histogram.h"
|
||||
@@ -14,7 +15,8 @@ struct Input {
|
||||
};
|
||||
|
||||
Input
|
||||
input_data(istream& in) {
|
||||
input_data(istream& in, bool prompt) {
|
||||
if (prompt==true){
|
||||
Input in;
|
||||
cerr << "Enter number count: ";
|
||||
cin >> in.number_count;
|
||||
@@ -32,13 +34,50 @@ input_data(istream& in) {
|
||||
size_t max_count;
|
||||
in.max_count = 0;
|
||||
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);
|
||||
vector<double> test;
|
||||
show_histogram_svg(bins, in.max_count, in.bin_count, test);
|
||||
|
||||
Ссылка в новой задаче
Block a user