Добавил недо-вывод в svg

master
MrDarkLast 2 лет назад
Родитель 4351ee1abe
Сommit 15364943a4

@ -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);

@ -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);
}

@ -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,0 +1,3 @@
10
3 3 4 4 4 4 4 5 5 5
3

@ -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();
}

@ -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);
Загрузка…
Отмена
Сохранить