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

65 строки
1.2 KiB
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( int argc, char* argv[]){
if (argc > 1){
cerr << "argc = " << argc << endl;
auto i = 0;
while (i < argc){
cerr << "argv[" << i << "] = " << argv[i] << '\n';
i++;
}
return 0;
}
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;
}