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