|
|
|
@ -12,25 +12,33 @@ struct Input
|
|
|
|
|
size_t bin_count{};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input input_data(istream& in) { // Ïðèíèìàåò ïîòîê ââîäà ïî ññûëêå
|
|
|
|
|
|
|
|
|
|
Input input_data(istream& in, bool prompt = true) { // Äîáàâëåí ïàðàìåòð prompt ñî çíà÷åíèåì ïî óìîë÷àíèþ
|
|
|
|
|
Input data;
|
|
|
|
|
size_t number_count;
|
|
|
|
|
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
in >> number_count; // ×òåíèå èç ïåðåäàííîãî ïîòîêà
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
}
|
|
|
|
|
in >> number_count;
|
|
|
|
|
|
|
|
|
|
data.numbers.resize(number_count);
|
|
|
|
|
cerr << "Enter numbers: ";
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter numbers: ";
|
|
|
|
|
}
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
in >> data.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cerr << "Enter number of bins: ";
|
|
|
|
|
if (prompt) {
|
|
|
|
|
cerr << "Enter number of bins: ";
|
|
|
|
|
}
|
|
|
|
|
in >> data.bin_count;
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
size_t max_count;
|
|
|
|
|