diff --git a/lab1.cpp b/lab1.cpp index 113e5d9..56c33ca 100644 --- a/lab1.cpp +++ b/lab1.cpp @@ -10,14 +10,23 @@ struct Input { size_t bin_count{}; }; -Input input_data(istream& in_stream) { +Input input_data(istream& in_stream, bool prompt) { Input in; size_t number_count; + if (prompt) { + cerr << "Введите количество значений" + } in_stream >> number_count; in.numbers.resize(number_count); + if (prompt) { + cerr << "Введите значения" + } for (size_t i = 0; i < number_count; i++) { in_stream >> in.numbers[i]; } + if (prompt) { + cerr << "Введите количество столбцов гистограммы" + } in_stream >> in.bin_count; return in; } @@ -26,7 +35,7 @@ int main() { const size_t SCREEN_WIDTH = 80; const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1; - auto in = input_data(cin); + auto in = input_data(cin, true); vector numbers_data = in.numbers; auto bins = make_histogram(in.numbers, in.bin_count); show_histogram_svg(bins, in.numbers, in.bin_count);