main
Родитель
1d08c45c2b
Сommit
0a7ae92249
@ -1,50 +1,42 @@
|
|||||||
#include <vector>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#include <fstream>
|
#include <vector>
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
#include "svg.h"
|
||||||
|
#include "histogram_internal.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const size_t SCREEN_WIDTH = 80;
|
struct Input {
|
||||||
const size_t MAX_ASTERISK = SCREEN_WIDTH - 3 - 1;
|
|
||||||
|
|
||||||
|
|
||||||
struct Input
|
|
||||||
{
|
|
||||||
vector<double> numbers;
|
vector<double> numbers;
|
||||||
size_t bin_count{};
|
size_t bin_count{};
|
||||||
|
size_t interval;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Input
|
Input
|
||||||
input_data(){
|
input_data(istream &tin, bool prompt){
|
||||||
|
if (prompt)
|
||||||
cerr << "Input numbers count: ";
|
cerr << "Input numbers count: ";
|
||||||
size_t number_count;
|
size_t number_count;
|
||||||
cin >> number_count;
|
tin >> number_count;
|
||||||
Input in;
|
Input in;
|
||||||
in.numbers.resize(number_count);
|
in.numbers.resize(number_count);
|
||||||
|
if (prompt)
|
||||||
cerr << "Input numbers: ";
|
cerr << "Input numbers: ";
|
||||||
for (size_t i = 0; i < number_count; i++)
|
for (size_t i = 0; i < number_count; i++) {
|
||||||
{
|
tin >> in.numbers[i];
|
||||||
cin >> in.numbers[i];
|
|
||||||
}
|
}
|
||||||
|
if (prompt)
|
||||||
cerr << "Input bin count: ";
|
cerr << "Input bin count: ";
|
||||||
cin >> in.bin_count;
|
tin >> in.bin_count;
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main() {
|
||||||
{
|
Input in = input_data(cin, false);
|
||||||
|
|
||||||
Input in = input_data();
|
|
||||||
|
|
||||||
auto bins = make_histogramm(in.numbers, in.bin_count);
|
auto bins = make_histogramm(in.numbers, in.bin_count);
|
||||||
|
show_histogram_svg(bins);
|
||||||
show_histogramm(bins);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Загрузка…
Ссылка в новой задаче