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