LedovskojMM 2 лет назад
Родитель d0a42c4314
Сommit 57140889ad

@ -3,6 +3,7 @@
#include <cmath> #include <cmath>
#include "histogam.h" #include "histogam.h"
#include "histogam_internal.h" #include "histogam_internal.h"
#include <conio.h>
using namespace std; using namespace std;
void find_minmax(vector<double> numbers, double& min, double& max) { void find_minmax(vector<double> numbers, double& min, double& max) {

@ -3,28 +3,47 @@
<iostream> <iostream>
<vector> <vector>
1682273505 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\main.cpp 1682281166 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\main.cpp
<iostream> <iostream>
<vector> <vector>
<cmath> <cmath>
<string>
"histogam.h" "histogam.h"
"text.h" "text.h"
"svg.h"
<conio.h>
1682273839 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.h 1682273839 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.h
<vector> <vector>
1682273664 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.cpp 1682280773 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam.cpp
<iostream> <iostream>
<vector> <vector>
<cmath> <cmath>
"histogam.h" "histogam.h"
"histogam_internal.h"
<conio.h>
1682273357 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\text.cpp 1682280773 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\text.cpp
<iostream> <iostream>
<vector> <vector>
<cmath> <cmath>
"text.h" "text.h"
<conio.h>
1682273447 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\text.h 1682273447 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\text.h
<vector> <vector>
1682273796 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\histogam_internal.h
<vector>
1682280585 source:c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\svg.cpp
<math.h>
<iostream>
<conio.h>
<vector>
<string>
"svg.h"
1682280301 c:\users\admin\onedrive\Ðàáî÷èé ñòîë\lab1\svg.h

@ -1,8 +1,11 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include <string>
#include "histogam.h" #include "histogam.h"
#include "text.h" #include "text.h"
#include "svg.h"
#include <conio.h>
using namespace std; using namespace std;
@ -32,7 +35,6 @@ int main()
{ {
Input in = input_data(); Input in = input_data();
auto bins = make_histogram(in.numbers, in.bin_count); auto bins = make_histogram(in.numbers, in.bin_count);
show_histogram_text(bins, in.bin_count); show_histogram_svg(bins);
return 0;
} }

@ -0,0 +1,37 @@
#include <math.h>
#include <iostream>
#include <conio.h>
#include <vector>
#include <string>
#include "svg.h"
using namespace std;
void
svg_begin(double width, double height) {
cout << "<?xml version='1.0' encoding='UTF-8'?>\n";
cout << "<svg ";
cout << "width='" << width << "' ";
cout << "height='" << height << "' ";
cout << "viewBox='0 0 " << width << " " << height << "' ";
cout << "xmlns='http://www.w3.org/2000/svg'>\n";
}
void
svg_end() {
cout << "</svg>\n";
}
void
svg_text(double left, double baseline, string text) {
cout << "<text x='" << left << "' y='" << baseline << "'>" << text << "</text>";
}
void
show_histogram_svg(const vector<size_t>& bins) {
svg_begin(400, 300);
svg_text(20, 20, to_string(bins[0]));
svg_end();
}

@ -0,0 +1,7 @@
#ifndef SVG_H_INCLUDED
#define SVG_H_INCLUDED
void
show_histogram_svg(const std::vector<size_t>& bins);
#endif // SVG_H_INCLUDED

@ -2,6 +2,7 @@
#include <vector> #include <vector>
#include <cmath> #include <cmath>
#include "text.h" #include "text.h"
#include <conio.h>
using namespace std; using namespace std;
void show_histogram_text(vector <size_t> bins, size_t bin_count ) { void show_histogram_text(vector <size_t> bins, size_t bin_count ) {

Загрузка…
Отмена
Сохранить