code: добавлен параметр prompt
Этот коммит содержится в:
12
main.cpp
12
main.cpp
@@ -12,10 +12,12 @@ struct Input
|
||||
};
|
||||
|
||||
Input
|
||||
input_data(istream& stream)
|
||||
input_data(istream& stream, bool prompt)
|
||||
{
|
||||
size_t number_count;
|
||||
cerr << "Enter number count: ";
|
||||
if (prompt) {
|
||||
cerr << "Enter number count: ";
|
||||
}
|
||||
stream >> number_count;
|
||||
Input in;
|
||||
in.numbers.resize(number_count);
|
||||
@@ -23,14 +25,16 @@ input_data(istream& stream)
|
||||
{
|
||||
stream >> in.numbers[i];
|
||||
}
|
||||
cerr << "Enter bin count: ";
|
||||
if (prompt) {
|
||||
cerr << "Enter bin count: ";
|
||||
}
|
||||
stream >> in.bin_count;
|
||||
return in;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Input in = input_data(cin);
|
||||
Input in = input_data(cin, true);
|
||||
vector<size_t> bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_svg(bins);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user