Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

54 строки
937 B
C++

#include <iostream>
#include <vector>
#include "histogram.h"
#include "text.h"
#include "svg.h"
#include <curl/curl.h>
using namespace std;
struct Input {
vector<double> numbers;
size_t bin_count{};
};
Input input_data(istream& in, bool prompt) {
size_t number_count;
if (prompt){
cerr << "Enter number count: ";
}
in >> number_count;
Input on;
if (prompt){
cerr << "Enter bin count: ";
}
in >> on.bin_count;
on.numbers.resize(number_count);
if (prompt){
cerr << "Enter numbers: ";
}
for (size_t i = 0; i < number_count; i++) {
in >> on.numbers[i];
}
return on;
};
int main(){
curl_global_init(CURL_GLOBAL_ALL);
bool prompt = true;
auto in = input_data(cin, prompt);
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_text(bins, in.bin_count);
show_histogram_svg(bins);
return 0;
}