code: ЛР4 параметр prompt

master
Alexander (AntonovichAN) 7 месяцев назад
Родитель 841f6d02cb
Сommit 91b6bea919

@ -13,20 +13,26 @@ struct Input {
size_t bin_count{};
};
Input input_data(istream& in) {
Input input_data(istream& in, bool prompt) {
size_t number_count;
if (prompt){
cerr << "Enter number count: ";
}
in >> number_count;
Input on;
if (prompt){
cerr << "Enter bin count: ";
}
in >> on.bin_count;
on.numbers.resize(number_count);
if (prompt){
cerr << "Enter numbers: ";
}
for (size_t i = 0; i < number_count; i++) {
in >> on.numbers[i];
}
@ -34,7 +40,8 @@ Input input_data(istream& in) {
};
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_text(bins, in.bin_count);
show_histogram_svg(bins);

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