Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
51 строка
842 B
C++
51 строка
842 B
C++
#include "histogram.h"
|
|
#include "svg.h"
|
|
using namespace std;
|
|
|
|
struct Input {
|
|
vector<double> numbers;
|
|
size_t bin_count{};
|
|
};
|
|
|
|
Input
|
|
input_data(istream& inn, bool prompt)
|
|
{
|
|
size_t number_count;
|
|
if (prompt == true)
|
|
cerr << "number_count = ";
|
|
inn >> number_count;
|
|
|
|
Input in;
|
|
in.numbers.resize(number_count);
|
|
|
|
if (prompt == true)
|
|
cerr << "numbers:";
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
inn >> in.numbers[i];
|
|
}
|
|
|
|
cerr << "columns = ";
|
|
cin >> in.bin_count;
|
|
return in;
|
|
}
|
|
|
|
int
|
|
main(int argc, char* argv[])
|
|
{
|
|
if (argc > 1)
|
|
{
|
|
cerr << argc;
|
|
for(int i = 0; i < argc; i++){
|
|
cerr << "argv[" << i << "] = " << argv[i];
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
auto in = input_data(cin, true);
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
show_histogram_svg(bins);
|
|
|
|
}
|