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