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

53 строки
981 B
C++

#include <iostream>
#include <vector>
using namespace std;
// Ñòðóêòóðà
struct Input
{
vector<double> numbers;
size_t bin_count{};
};
// Ââîä îöåíêîê ñ êëàâèàòóðû.
Input
input_data()
{
Input in;
size_t number_count, bin_count;
cerr << "Enter number count: ";
cin >> number_count;
in.numbers.resize(number_count);
for (size_t i = 0; i < number_count; i++)
cin >> in.numbers[i];
cerr << "Enter bin count: ";
cin >> in.bin_count;
return in;
}
// Ïîèñê ìàêñèìóìà è ìèíèìóìà ñðåäè îöåíîê.
void find_minmax(const vector<double>& numbers, double& min, double& max)
{
min = numbers[0];
max = numbers[0];
for (double x : numbers)
{
if (x < min)
min = x;
else if (x > max)
max = x;
}
}
int main()
{
auto in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_text(bins, ...);
}