Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

55 строки
943 B
C++

using namespace std;
#include "histogram.h"
#include "text.h"
#include "svg.h"
//313
struct Input {
std::vector<double> numbers;
size_t bin_count{};
};
Input input_data(istream& in, bool promt);
int main()
{
Input in = input_data(cin,true);
std::vector<size_t> bins = make_histogram(in.numbers, in.bin_count);
show_histogram_svg(bins);
return 0;
}
Input input_data(istream& in, bool promt) {
Input input_struct;
size_t countOfNumbers;
if(promt){cerr << "Input your count of numbers:\n";}
cin >> countOfNumbers;
input_struct.numbers.resize(countOfNumbers);
if(promt){cerr << "Input numbers:\n";}
for (int i = 0; i < countOfNumbers; i++) {
if(promt){cerr << i << ":" << endl;}
cin >> input_struct.numbers[i];
}
if(promt){
cerr << endl;
cerr << "Input bin count:\n";
}
cin >> input_struct.bin_count;
return input_struct;
}