code: добавление параметра bool prompt

master
ArtyushinaVV 2 лет назад
Родитель 3e31671e2d
Сommit 5f41788050

@ -15,32 +15,34 @@ struct Input
}; };
Input Input
input_data(istream& in) input_data(istream& in, bool prompt)
{ {
if(prompt)
cerr << "count=";
size_t number_count; size_t number_count;
cerr << "count=";
in >> number_count; in >> number_count;
Input rez; Input rez;
if(prompt)
cerr << "bin_count= ";
rez.numbers.resize(number_count); rez.numbers.resize(number_count);
for (size_t i = 0; i < number_count; i++) for (size_t i = 0; i < number_count; i++)
{ {
in >> rez.numbers[i]; in >> rez.numbers[i];
} }
if(prompt)
cerr << "bin_count= "; cerr << "bin_count= ";
in >> rez.bin_count; in >> rez.bin_count;
return rez; return rez;
} }
int main() 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); auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins); show_histogram_svg(bins);
return 0; return 0;

Загрузка…
Отмена
Сохранить