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