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