Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
60 строки
903 B
C++
60 строки
903 B
C++
#include <iostream>
|
|
#include <vector>
|
|
#include <cmath>
|
|
#include "histogram.h"
|
|
#include "svg.h"
|
|
|
|
using namespace std;
|
|
|
|
struct Input
|
|
{
|
|
vector<double> numbers;
|
|
int bin_count;
|
|
};
|
|
Input
|
|
input_data(istream& in)
|
|
{
|
|
size_t number_count=0;
|
|
bool prompt;
|
|
if (promt){
|
|
cerr<<"amount of numbers is ";
|
|
}
|
|
|
|
in >> number_count;
|
|
Input inp;
|
|
inp.numbers.resize(number_count);
|
|
if (promt){
|
|
cerr<<"let's intro numbers ";
|
|
}
|
|
|
|
for (size_t i = 0; i < number_count; i++)
|
|
{
|
|
in >> inp.numbers[i];
|
|
}
|
|
size_t bin_count=0;
|
|
if (promt){
|
|
cerr<<"amount of bins is ";
|
|
}
|
|
in >> inp.bin_count;
|
|
return inp;
|
|
}
|
|
//4199705
|
|
//0x71fdf8
|
|
//4199705
|
|
|
|
int main()
|
|
{
|
|
auto inp = input_data(cin);
|
|
|
|
|
|
|
|
//std::cout<<in.bin_count<<endl;
|
|
|
|
|
|
auto bins = make_histogram(inp.numbers, inp.bin_count);
|
|
show_histogram_svg(bins);
|
|
|
|
|
|
return 0;
|
|
}
|