code: перенос файла
Этот коммит содержится в:
27
main.cpp
27
main.cpp
@@ -1,9 +1,10 @@
|
|||||||
|
#include <curl/curl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "svg.h"
|
#include "svg.h"
|
||||||
//#include "doctest.h"
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct Input {
|
struct Input {
|
||||||
@@ -12,14 +13,15 @@ struct Input {
|
|||||||
size_t block_width{};
|
size_t block_width{};
|
||||||
};
|
};
|
||||||
|
|
||||||
Input input_data(istream& in_steam = cin, bool prompt = true) {
|
Input input_data(istream& in_stream = cin, bool prompt = true) {
|
||||||
size_t number_count;
|
|
||||||
if (prompt) {
|
|
||||||
cerr << "Enter number count: ";
|
|
||||||
}
|
|
||||||
in_steam >> number_count;
|
|
||||||
|
|
||||||
Input in;
|
Input in;
|
||||||
|
size_t number_count;
|
||||||
|
|
||||||
|
if (prompt) {
|
||||||
|
cerr << "Enter number count: ";
|
||||||
|
}
|
||||||
|
in_stream >> number_count;
|
||||||
|
|
||||||
in.numbers.resize(number_count);
|
in.numbers.resize(number_count);
|
||||||
|
|
||||||
if (prompt) {
|
if (prompt) {
|
||||||
@@ -37,11 +39,16 @@ Input input_data(istream& in_steam = cin, bool prompt = true) {
|
|||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
if (res != CURLE_OK) {
|
||||||
|
cerr << "cURL initialization failed: " << curl_easy_strerror(res) << endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
auto in = input_data();
|
auto in = input_data();
|
||||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||||
show_histogram_svg(bins, in.block_width);
|
show_histogram_svg(bins, in.block_width);
|
||||||
|
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user