Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
54 строки
839 B
C++
54 строки
839 B
C++
using namespace std;
|
|
#include "histogram.h"
|
|
#include "text.h"
|
|
|
|
#include <cstdio>
|
|
|
|
struct Input {
|
|
std::vector<double> numbers;
|
|
size_t bin_count{};
|
|
};
|
|
|
|
|
|
|
|
Input input_data();
|
|
|
|
|
|
|
|
int main()
|
|
{
|
|
|
|
Input in = input_data();
|
|
std::vector<size_t> bins = make_histogram(in.numbers, in.bin_count);
|
|
show_histogram_text(bins, in.bin_count);
|
|
return 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Input input_data() {
|
|
Input input_struct;
|
|
size_t countOfNumbers;
|
|
cerr << "Input your count of numbers:\n";
|
|
cin >> countOfNumbers;
|
|
|
|
input_struct.numbers.resize(countOfNumbers);
|
|
|
|
cerr << "Input bin count:\n";
|
|
cin >> input_struct.bin_count;
|
|
cerr << "Input numbers:\n";
|
|
for (int i = 0; i < countOfNumbers; i++) {
|
|
cerr << i << ":" << endl;
|
|
cin >> input_struct.numbers[i];
|
|
}
|
|
cerr << endl;
|
|
return input_struct;
|
|
}
|
|
|
|
|
|
|
|
|
|
|