|
|
|
@ -21,42 +21,42 @@ input_data() {
|
|
|
|
|
cerr << "Enter number count: ";
|
|
|
|
|
cin >> number_count;
|
|
|
|
|
|
|
|
|
|
Input in;
|
|
|
|
|
in.numbers.resize(number_count);
|
|
|
|
|
Input in1;
|
|
|
|
|
in1.numbers.resize(number_count);
|
|
|
|
|
cerr << "Enter numbers: ";
|
|
|
|
|
for (size_t i = 0; i < number_count; i++) {
|
|
|
|
|
cin >> in.numbers[i];
|
|
|
|
|
cin >> in1.numbers[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cerr << "Enter bin count: ";
|
|
|
|
|
cin >> in.bin_count;
|
|
|
|
|
cin >> in1.bin_count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cerr << "Enter stroke colour without spaces or in code format:";
|
|
|
|
|
cin.ignore();
|
|
|
|
|
getline(cin, in.stroke);
|
|
|
|
|
getline(cin, in1.stroke);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < in.stroke.length(); i++) {
|
|
|
|
|
if (isspace(in.stroke[i])) {
|
|
|
|
|
for (i = 0; i < in1.stroke.length(); i++) {
|
|
|
|
|
if (isspace(in1.stroke[i])) {
|
|
|
|
|
cerr << "invalid input";
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (in.stroke[0] == check2[0]) {
|
|
|
|
|
if (in.stroke.length() != 7) {
|
|
|
|
|
if (in1.stroke[0] == check2[0]) {
|
|
|
|
|
if (in1.stroke.length() != 7) {
|
|
|
|
|
cerr << "invalid input";
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return in;
|
|
|
|
|
return in1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
const size_t SCREEN_WIDTH = 80;
|
|
|
|
|
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
|
|
|
|
|
auto in = input_data();
|
|
|
|
|
auto bins = make_histogram(in.numbers, in.bin_count);
|
|
|
|
|
show_histogram_svg(bins, in.stroke);
|
|
|
|
|
auto in1 = input_data();
|
|
|
|
|
auto bins = make_histogram(in1.numbers, in1.bin_count);
|
|
|
|
|
show_histogram_svg(bins, in1.stroke);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|