code: add prompt
Этот коммит содержится в:
10
main.cpp
10
main.cpp
@@ -11,9 +11,11 @@ struct Input {
|
||||
size_t bin_count{};
|
||||
};
|
||||
|
||||
Input input_data(istream& in1) {
|
||||
Input input_data(istream& in1, bool prompt) {
|
||||
size_t number_count;
|
||||
if (prompt) {
|
||||
cerr << "Enter number count: ";
|
||||
}
|
||||
in1 >> number_count;
|
||||
|
||||
Input in;
|
||||
@@ -24,8 +26,9 @@ Input input_data(istream& in1) {
|
||||
{
|
||||
in1 >> in.numbers[i];
|
||||
}
|
||||
|
||||
if (prompt) {
|
||||
cerr << "Enter number bin: ";
|
||||
}
|
||||
in1 >> in.bin_count;
|
||||
|
||||
return in;
|
||||
@@ -35,7 +38,8 @@ Input input_data(istream& in1) {
|
||||
|
||||
int main()
|
||||
{
|
||||
auto in = input_data(cin);
|
||||
bool prompt = false;
|
||||
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);
|
||||
|
||||
Ссылка в новой задаче
Block a user