|
|
|
@ -19,53 +19,54 @@ struct Input
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Input
|
|
|
|
|
input_data(istream& in)
|
|
|
|
|
input_data(istream& in, bool promt)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
size_t number_count, bin_count, IMAGE_WIDTH;
|
|
|
|
|
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
if (promt) cerr << "Enter number count: ";
|
|
|
|
|
in >> number_count;
|
|
|
|
|
|
|
|
|
|
Input n;
|
|
|
|
|
Input input;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cerr << " Input width of image, > 70 but not >800 : ";
|
|
|
|
|
in >> n.IMAGE_WIDTH;
|
|
|
|
|
if(n.IMAGE_WIDTH < 70 || n.IMAGE_WIDTH > 800 ) {
|
|
|
|
|
while(n.IMAGE_WIDTH < 70 || n.IMAGE_WIDTH > 800) {
|
|
|
|
|
cerr << " Input width of image, >70 but not >800 : ";
|
|
|
|
|
in >> n.IMAGE_WIDTH;
|
|
|
|
|
|
|
|
|
|
if (promt) cerr << " Input width of image, > 70 but not >800 : ";
|
|
|
|
|
in >> input.IMAGE_WIDTH;
|
|
|
|
|
if(input.IMAGE_WIDTH < 70 || input.IMAGE_WIDTH > 800 ) {
|
|
|
|
|
while(input.IMAGE_WIDTH < 70 || input.IMAGE_WIDTH > 800) {
|
|
|
|
|
if (promt) cerr << " Input width of image, >70 but not >800 : ";
|
|
|
|
|
in >> input.IMAGE_WIDTH;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//size_t number_count = in.number_counts;
|
|
|
|
|
|
|
|
|
|
n.numbers.resize( number_count );
|
|
|
|
|
cerr << "Enter numbers: ";
|
|
|
|
|
input.numbers.resize( number_count );
|
|
|
|
|
if (promt) cerr << "Enter numbers: ";
|
|
|
|
|
// vector<double> numbers(number_count);
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < number_count; i++)
|
|
|
|
|
{
|
|
|
|
|
in >> n.numbers[i];
|
|
|
|
|
in >> input.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cerr << "Count of baskets: ";
|
|
|
|
|
in >> n.bin_count;
|
|
|
|
|
if (promt) cerr << "Count of baskets: ";
|
|
|
|
|
in >> input.bin_count;
|
|
|
|
|
|
|
|
|
|
return n;
|
|
|
|
|
return input;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
auto n = input_data(cin);
|
|
|
|
|
auto bins = make_histogram( n.numbers, n.bin_count );
|
|
|
|
|
auto input = input_data(cin, true);
|
|
|
|
|
auto bins = make_histogram( input.numbers, input.bin_count );
|
|
|
|
|
//int chek_block_width(in.IMAGE_WIDTH);
|
|
|
|
|
//chek_block_width(in.IMAGE_WIDTH, in.number_count);
|
|
|
|
|
//if (chek_block_width==1)
|
|
|
|
|
show_histogram_svg( bins,n.IMAGE_WIDTH );
|
|
|
|
|
show_histogram_svg( bins, input.IMAGE_WIDTH );
|
|
|
|
|
//if(chek_block_width==0) return 0;
|
|
|
|
|
//show_histogram_svg(bins);
|
|
|
|
|
|
|
|
|
|