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