добавленна проверка на вывод подсказок
Этот коммит содержится в:
31
main.cpp
31
main.cpp
@@ -15,26 +15,31 @@ struct Input {
|
||||
};
|
||||
|
||||
Input
|
||||
input_data() {
|
||||
input_data(istream& in, bool prompt = true){
|
||||
size_t number_count;
|
||||
Input in;
|
||||
cerr << "Enter number_count ";
|
||||
cin >> number_count;
|
||||
Input iiin;
|
||||
if (prompt == true) {
|
||||
|
||||
in.numbers.resize(number_count);
|
||||
cerr << "Enter numbers ";
|
||||
for (int i = 0; i < number_count;i++) {
|
||||
cin >> in.numbers[i];
|
||||
cerr << "Enter number_count ";
|
||||
}
|
||||
in >> number_count;
|
||||
|
||||
cerr << "Enter bin count \n";
|
||||
cin >> in.bin_count;
|
||||
|
||||
return in;
|
||||
iiin.numbers.resize(number_count);
|
||||
if (prompt == true) {
|
||||
cerr << "Enter numbers ";
|
||||
}
|
||||
for (int i = 0; i < number_count;i++) {
|
||||
in >> iiin.numbers[i];
|
||||
}
|
||||
if (prompt == true) {
|
||||
cerr << "Enter bin count \n";
|
||||
in >> iiin.bin_count;
|
||||
}
|
||||
return iiin;
|
||||
}
|
||||
|
||||
int main() {
|
||||
Input in = input_data();
|
||||
Input in = input_data(cin);
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_svg(bins);
|
||||
return 0;
|
||||
|
||||
Ссылка в новой задаче
Block a user