Пивоваров Ярослав 2 лет назад
Родитель 9a4b65ee9a
Сommit 298322cd64

@ -3,6 +3,7 @@
#include <cmath> #include <cmath>
#include "histogram.h" #include "histogram.h"
#include "histogram_internal.h" #include "histogram_internal.h"
#include <conio.h>
using namespace std; using namespace std;
void find_minmax(const vector<double> numbers, double& min, double& max) { void find_minmax(const vector<double> numbers, double& min, double& max) {
min = numbers[0]; min = numbers[0];

@ -3,6 +3,9 @@
#include <cmath> #include <cmath>
#include "histogram.h" #include "histogram.h"
#include "text.h" #include "text.h"
#include "svg.h"
#include <string>
#include <conio.h>
using namespace std; using namespace std;
@ -36,7 +39,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;
} }

@ -1,30 +1,47 @@
# depslib dependency file v1.0 # depslib dependency file v1.0
1682273367 source:c:\users\hp\desktop\lab-03\project3\main.cpp 1682281180 source:c:\users\hp\desktop\lab-03\project3\main.cpp
<iostream> <iostream>
<vector> <vector>
<cmath> <cmath>
"histogram.h" "histogram.h"
"text.h" "text.h"
"svg.h"
<string>
<conio.h>
1682271918 c:\users\hp\desktop\lab-03\project3\histogram.h 1682271918 c:\users\hp\desktop\lab-03\project3\histogram.h
<vector> <vector>
1682273878 source:c:\users\hp\desktop\lab-03\project3\histogram.cpp 1682280773 source:c:\users\hp\desktop\lab-03\project3\histogram.cpp
<iostream> <iostream>
<vector> <vector>
<cmath> <cmath>
"histogram.h" "histogram.h"
"histogram_internal.h" "histogram_internal.h"
<conio.h>
1682273206 source:c:\users\hp\desktop\lab-03\project3\text.cpp 1682280773 source:c:\users\hp\desktop\lab-03\project3\text.cpp
<iostream> <iostream>
<vector> <vector>
<cmath> <cmath>
"text.h" "text.h"
<conio.h>
1682273446 c:\users\hp\desktop\lab-03\project3\text.h 1682273446 c:\users\hp\desktop\lab-03\project3\text.h
<vector> <vector>
1682273933 c:\users\hp\desktop\lab-03\project3\histogram_internal.h 1682275464 c:\users\hp\desktop\lab-03\project3\histogram_internal.h
<vector>
1682280773 source:c:\users\hp\desktop\lab-03\project3\svg.cpp
<math.h>
<iostream>
<conio.h>
<vector>
<string>
"svg.h"
<conio.h>
1682278136 c:\users\hp\desktop\lab-03\project3\svg.h
<vector> <vector>

@ -0,0 +1,35 @@
#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
#include <vector>
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 ) {

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