пункт 4.1: добавлен поток ввода
Этот коммит содержится в:
14
main.cpp
14
main.cpp
@@ -13,28 +13,28 @@ struct Input {
|
||||
double USER_BIN_HEIGHT{};
|
||||
};
|
||||
|
||||
Input input_data() {
|
||||
Input input_data(istream& stream) {
|
||||
|
||||
size_t number_count;
|
||||
|
||||
cerr << "Enter number count: ";
|
||||
cin >> number_count;
|
||||
stream >> number_count;
|
||||
|
||||
Input in;
|
||||
|
||||
cerr << "Enter number of bins: ";
|
||||
cin >> in.bin_count;
|
||||
stream >> in.bin_count;
|
||||
|
||||
in.numbers.resize(number_count);
|
||||
|
||||
cerr << "Enter numbers: ";
|
||||
for (size_t i = 0; i < number_count; i++)
|
||||
{
|
||||
cin >> in.numbers[i];
|
||||
stream >> in.numbers[i];
|
||||
}
|
||||
|
||||
cerr << "Enter image height: ";
|
||||
cin >> in.USER_BIN_HEIGHT;
|
||||
stream >> in.USER_BIN_HEIGHT;
|
||||
|
||||
return in;
|
||||
}
|
||||
@@ -44,9 +44,7 @@ Input input_data() {
|
||||
|
||||
int main(){
|
||||
|
||||
bool res = false;
|
||||
|
||||
Input in = input_data();
|
||||
Input in = input_data(cin);
|
||||
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
</Compiler>
|
||||
<Unit filename="svg.cpp" />
|
||||
<Unit filename="svg.h" />
|
||||
<Unit filename="svg_internal.h">
|
||||
<Option target="<{~None~}>" />
|
||||
</Unit>
|
||||
<Unit filename="unittest_svg.cpp" />
|
||||
<Extensions>
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
|
||||
Ссылка в новой задаче
Block a user