code: input data add(instream)
Этот коммит содержится в:
43
main.cpp
43
main.cpp
@@ -8,10 +8,47 @@
|
||||
#include "svg.h"
|
||||
using namespace std;
|
||||
|
||||
const size_t SCREEN_WIDTH = 80;
|
||||
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
|
||||
|
||||
struct Input
|
||||
{
|
||||
vector<double> numbers;
|
||||
size_t bin_count{};
|
||||
};
|
||||
|
||||
|
||||
Input
|
||||
input_data(istream& in){
|
||||
cerr << "Input numbers count: ";
|
||||
size_t number_count;
|
||||
in >> number_count;
|
||||
|
||||
Input ik;
|
||||
ik.numbers.resize(number_count);
|
||||
cerr << "Input numbers: ";
|
||||
for (size_t i = 0; i < number_count; i++)
|
||||
{
|
||||
cin >> ik.numbers[i];
|
||||
}
|
||||
cerr << "Input bin count: ";
|
||||
cin>> ik.bin_count;
|
||||
return ik;
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
Input in = input_data(cin);
|
||||
|
||||
auto bins = make_histogramm(in.numbers, in.bin_count);
|
||||
|
||||
show_histogram_svg(bins);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
struct Input
|
||||
{
|
||||
vector<double> numbers;
|
||||
@@ -47,4 +84,4 @@ int main()
|
||||
show_histogram_svg(bins);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
Ссылка в новой задаче
Block a user