Добавил недо-вывод в svg
Этот коммит содержится в:
@@ -2,7 +2,7 @@
|
||||
#include "histogram_internal.h"
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
|
||||
vector<size_t> make_histogram(const vector<double>& numbers, size_t bin_count) {
|
||||
|
||||
vector<size_t> bins(bin_count);
|
||||
@@ -43,7 +43,7 @@ vector<size_t> make_histogram(const vector<double>& numbers, size_t bin_count) {
|
||||
}
|
||||
}
|
||||
return bins;
|
||||
} */
|
||||
}
|
||||
|
||||
bool find_minmax(const vector<double>& numbers, double& min, double& max) {
|
||||
if (numbers.size() == 0) {
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
std::vector<size_t>
|
||||
make_histogram(const std::vector<double>& numbers, size_t bin_count);
|
||||
std::vector<size_t> make_histogram(const std::vector<double>& numbers, size_t bin_count);
|
||||
void find_minmax(const std::vector<double>& numbers, double& min, double& max);
|
||||
8
lab1.cpp
8
lab1.cpp
@@ -1,11 +1,11 @@
|
||||
// lab1.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
|
||||
//
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include "histogram.h"
|
||||
#include "text.h"
|
||||
#include "svg.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -40,7 +40,7 @@ int main()
|
||||
{
|
||||
Input in = input_data();
|
||||
auto bins = make_histogram(in.numbers, in.bin_count);
|
||||
show_histogram_text(bins, in.bin_count);
|
||||
|
||||
//show_histogram_text(bins, in.bin_count);
|
||||
show_histogram_svg(bins);
|
||||
|
||||
}
|
||||
4
lab1.sln
4
lab1.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32922.545
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab1", "lab1\lab1.vcxproj", "{E29B0ECE-B766-48CE-A826-ACFB8EFF2990}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab1", "lab1.vcxproj", "{E29B0ECE-B766-48CE-A826-ACFB8EFF2990}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -26,6 +26,6 @@ Global
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2E4B7C6A-7457-47BC-985A-B37A534B97DD}
|
||||
SolutionGuid = {5DF3BD0D-8660-486C-B0A4-A7F22876A15B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -129,11 +129,12 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="histogram.cpp" />
|
||||
<ClCompile Include="lab1.cpp" />
|
||||
<ClCompile Include="svg.cpp" />
|
||||
<ClCompile Include="text.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="histogram.h" />
|
||||
<ClInclude Include="histogram_internal.h" />
|
||||
<ClInclude Include="svg.h" />
|
||||
<ClInclude Include="text.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<ClCompile Include="text.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="svg.cpp">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="histogram.h">
|
||||
@@ -32,7 +35,7 @@
|
||||
<ClInclude Include="text.h">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="histogram_internal.h">
|
||||
<ClInclude Include="svg.h">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
0
marks.svg
Обычный файл
0
marks.svg
Обычный файл
3
marks.txt
Обычный файл
3
marks.txt
Обычный файл
@@ -0,0 +1,3 @@
|
||||
10
|
||||
3 3 4 4 4 4 4 5 5 5
|
||||
3
|
||||
25
svg.cpp
Обычный файл
25
svg.cpp
Обычный файл
@@ -0,0 +1,25 @@
|
||||
#include <iostream>
|
||||
#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 show_histogram_svg(const vector<size_t>& bins) {
|
||||
svg_begin(400, 300);
|
||||
svg_end();
|
||||
}
|
||||
7
svg.h
Обычный файл
7
svg.h
Обычный файл
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
void svg_begin(double width, double height);
|
||||
void svg_end();
|
||||
void show_histogram_svg(const std::vector<size_t>& bins);
|
||||
Ссылка в новой задаче
Block a user