Сравнить коммиты
Ничего общего в коммитах. 'main' и 'master' имеют совершенно разные истории.
@ -1,3 +1,363 @@
|
|||||||
/bin
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
/curl
|
## files generated by popular Visual Studio add-ons.
|
||||||
/obj
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Oo]ut/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd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EXtNAVSdOwNtKq6dxyHjA2ecb4RmTFr1Kfm0BCl4yovQBOL64JKWVHtX2RyUX/FBSPg8wuI6Z+oaM7w/97zzxg+h4YJMv0VfgQx3PYoz3eOYd7WYwMVsqsRpJiRCnEmYfItdea7ORp1PBJjeilqFeEy34E/zuhFt1Tdo0OtIjbsiYGs8W6mdRYZS5T5S5v9/RdqWaCu7BiLMjylELYv4GT0JcZIJllrIMKhxKdp4ZdsC41lQS5FBZJBh2QZUfnd6Ca5DTJFOW5Dcbe8wxjbh7CrDgFbidZunU6tBz/oTptzJxlZ6WnZnRfHk7dPGy9aRFlpU8mRZ1v5C1462gM= nn110@LAPTOP-P049CSND
|
@ -1 +0,0 @@
|
|||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@ -1,59 +1,60 @@
|
|||||||
#include <math.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <conio.h>
|
|
||||||
#include <vector>
|
|
||||||
#include "histogram.h"
|
#include "histogram.h"
|
||||||
#include "histogram_internal.h"
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
void find_minmax(const vector<double>& numbers, double& min, double& max) {
|
||||||
|
min = numbers[0];
|
||||||
|
for (auto i = 0; i < numbers.size(); i++) {
|
||||||
|
if (numbers[i] < min) {
|
||||||
|
min = numbers[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
max = numbers[0];
|
||||||
find_minmax(vector<double> numbers, double &min, double &max) {
|
for (auto i = 0; i < numbers.size(); i++) {
|
||||||
|
if (numbers[i] > max) {
|
||||||
bool notEmpty = true;
|
max = numbers[i];
|
||||||
if (numbers.size() == 0 || numbers.size() == 1)
|
|
||||||
notEmpty = false;
|
|
||||||
else{
|
|
||||||
min = numbers[0];
|
|
||||||
max = numbers[0];
|
|
||||||
for (size_t i = 1; i < numbers.size(); i++) {
|
|
||||||
if (min > numbers[i])
|
|
||||||
min = numbers[i];
|
|
||||||
if (max < numbers[i])
|
|
||||||
max = numbers[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return notEmpty;
|
|
||||||
}
|
}
|
||||||
|
vector<size_t> make_histogram(const vector<double>& numbers, size_t bin_count) {
|
||||||
|
|
||||||
|
vector<size_t> bins(bin_count);
|
||||||
|
vector<size_t> binss(bin_count);
|
||||||
|
|
||||||
vector <size_t> make_histogramm(vector<double>numbers, size_t bin_count){
|
double max, min;
|
||||||
double min, max;
|
find_minmax(numbers, min, max);
|
||||||
bool haveElements = find_minmax(numbers, min, max);
|
double bin_size = (max / min) / bin_count;
|
||||||
if (haveElements){
|
|
||||||
double binSize = (max - min) / bin_count;
|
for (size_t i = 0; i < numbers.size(); i++) {
|
||||||
vector<size_t> bins(bin_count);
|
bool found = false;
|
||||||
for (size_t i = 0; i < numbers.size(); i++) {
|
for (size_t j = 0; (j < bin_count - 1) && !found; j++) {
|
||||||
bool found = false;
|
auto lo = min + j * bin_size;
|
||||||
for (size_t j = 0; (j <= bin_count - 1) && !found; j++) {
|
auto hi = min + (j + 1) * bin_size;
|
||||||
auto lo = min + j * binSize;
|
if ((lo <= numbers[i]) && (numbers[i] < hi)) {
|
||||||
auto hi = min + (j + 1) * binSize;
|
bins[j]++;
|
||||||
if ((numbers[i] >= lo) && (numbers[i] < hi)) {
|
found = true;
|
||||||
bins[j]++;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!found)
|
|
||||||
bins[bin_count - 1]++;
|
|
||||||
}
|
}
|
||||||
return bins;
|
if (!found) {
|
||||||
|
bins[bin_count - 1]++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cerr << "Empty massive of numbers";
|
int max_count = bins[0];
|
||||||
}
|
for (size_t i = 0; i < bin_count; i++) {
|
||||||
bool check_interval(size_t interval){
|
if (bins[i] > max_count) {
|
||||||
bool need;
|
max_count = bins[i];
|
||||||
if (interval > 9 || interval < 2)
|
}
|
||||||
need = false;
|
}
|
||||||
else
|
|
||||||
need = true;
|
if (max_count > 76) {
|
||||||
return need;
|
|
||||||
}
|
for (size_t i = 0; i < bin_count; i++) {
|
||||||
|
int count = bins[i];
|
||||||
|
size_t height = 76 * (static_cast<double>(count) / max_count);
|
||||||
|
bins[i] = height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bins;
|
||||||
|
}
|
@ -1,10 +1,4 @@
|
|||||||
#ifndef HISTOGRAM_H_INCLUDED
|
|
||||||
#define HISTOGRAM_H_INCLUDED
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
std::vector<size_t>
|
std::vector<size_t>
|
||||||
make_histogramm(std::vector<double> numbers, size_t bin_count);
|
make_histogram(const std::vector<double>& numbers, size_t bin_count);
|
||||||
|
|
||||||
|
|
||||||
#endif // HISTOGRAM_H_INCLUDED
|
|
@ -1,8 +0,0 @@
|
|||||||
#ifndef HISTOGRAM_INTERNAL_H_INCLUDED
|
|
||||||
#define HISTOGRAM_INTERNAL_H_INCLUDED
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
bool find_minmax(std::vector<double> numbers, double &min, double &max);
|
|
||||||
|
|
||||||
#endif // HISTOGRAM_INTERNAL_H_INCLUDED
|
|
@ -0,0 +1,135 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{e29b0ece-b766-48ce-a826-acfb8eff2990}</ProjectGuid>
|
||||||
|
<RootNamespace>lab1</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="lab1.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Исходные файлы">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Файлы заголовков">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Файлы ресурсов">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="lab1.cpp">
|
||||||
|
<Filter>Исходные файлы</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -1,53 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_project_file>
|
|
||||||
<FileVersion major="1" minor="6" />
|
|
||||||
<Project>
|
|
||||||
<Option title="lab3" />
|
|
||||||
<Option pch_mode="2" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Build>
|
|
||||||
<Target title="Debug">
|
|
||||||
<Option output="bin/Debug/lab3" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj/Debug/" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-g" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add option="-static-libstdc++" />
|
|
||||||
<Add option="-static-libgcc" />
|
|
||||||
<Add option="-static" />
|
|
||||||
</Linker>
|
|
||||||
</Target>
|
|
||||||
<Target title="Release">
|
|
||||||
<Option output="bin/Release/lab3" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj/Release/" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-O2" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add option="-s" />
|
|
||||||
</Linker>
|
|
||||||
</Target>
|
|
||||||
</Build>
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-Wall" />
|
|
||||||
<Add option="-fexceptions" />
|
|
||||||
</Compiler>
|
|
||||||
<Unit filename="ddd.h" />
|
|
||||||
<Unit filename="histogram.cpp" />
|
|
||||||
<Unit filename="histogram.h" />
|
|
||||||
<Unit filename="histogram_internal.h" />
|
|
||||||
<Unit filename="main.cpp" />
|
|
||||||
<Unit filename="svg.cpp" />
|
|
||||||
<Unit filename="svg.h" />
|
|
||||||
<Unit filename="text.cpp" />
|
|
||||||
<Unit filename="text.h" />
|
|
||||||
<Extensions>
|
|
||||||
<lib_finder disable_auto="1" />
|
|
||||||
</Extensions>
|
|
||||||
</Project>
|
|
||||||
</CodeBlocks_project_file>
|
|
@ -1,33 +0,0 @@
|
|||||||
# depslib dependency file v1.0
|
|
||||||
1685858392 source:c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\histogram.cpp
|
|
||||||
<math.h>
|
|
||||||
<iostream>
|
|
||||||
<conio.h>
|
|
||||||
<vector>
|
|
||||||
"histogram.h"
|
|
||||||
|
|
||||||
1685858387 c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\histogram.h
|
|
||||||
<vector>
|
|
||||||
|
|
||||||
1685861365 source:c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\main.cpp
|
|
||||||
<vector>
|
|
||||||
<math.h>
|
|
||||||
<iostream>
|
|
||||||
<conio.h>
|
|
||||||
<fstream>
|
|
||||||
"histogram.h"
|
|
||||||
"text.h"
|
|
||||||
"svg.h"
|
|
||||||
|
|
||||||
1685858389 source:c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\text.cpp
|
|
||||||
<math.h>
|
|
||||||
<iostream>
|
|
||||||
<conio.h>
|
|
||||||
<vector>
|
|
||||||
"text.h"
|
|
||||||
|
|
||||||
1685858378 c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\text.h
|
|
||||||
<vector>
|
|
||||||
|
|
||||||
1685862500 c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\svg.h
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_layout_file>
|
|
||||||
<FileVersion major="1" minor="0" />
|
|
||||||
<ActiveTarget name="Debug" />
|
|
||||||
<File name="histogram.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="167" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="svg.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="137" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="ddd.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="0" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="histogram.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="1587" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="svg.cpp" open="1" top="1" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="1589" topLine="2" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="histogram_internal.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="216" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="text.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="148" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="text.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="377" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="main.cpp" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="327" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
</CodeBlocks_layout_file>
|
|
@ -1,81 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <conio.h>
|
|
||||||
#include <vector>
|
|
||||||
#include "histogram.h"
|
|
||||||
#include "text.h"
|
|
||||||
#include "svg.h"
|
|
||||||
#include "histogram_internal.h"
|
|
||||||
#include <curl/curl.h>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
struct Input {
|
|
||||||
vector<double> numbers;
|
|
||||||
size_t bin_count{};
|
|
||||||
size_t interval;
|
|
||||||
};
|
|
||||||
|
|
||||||
Input
|
|
||||||
input_data(istream &tin, bool prompt){
|
|
||||||
if (prompt)
|
|
||||||
cerr << "Input numbers count: ";
|
|
||||||
size_t number_count;
|
|
||||||
tin >> number_count;
|
|
||||||
Input in;
|
|
||||||
in.numbers.resize(number_count);
|
|
||||||
if (prompt)
|
|
||||||
cerr << "Input numbers: ";
|
|
||||||
for (size_t i = 0; i < number_count; i++) {
|
|
||||||
tin >> in.numbers[i];
|
|
||||||
}
|
|
||||||
if (prompt)
|
|
||||||
cerr << "Input bin count: ";
|
|
||||||
tin >> in.bin_count;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
size_t
|
|
||||||
write_data(void* items, size_t item_size, size_t item_count, void* ctx) {
|
|
||||||
size_t data_size = item_size * item_count;
|
|
||||||
stringstream* buffer = reinterpret_cast<stringstream*>(ctx);
|
|
||||||
buffer->write(reinterpret_cast<const char*>(items), data_size);
|
|
||||||
return data_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
Input
|
|
||||||
download(const string& address) {
|
|
||||||
stringstream buffer;
|
|
||||||
CURL *curl = curl_easy_init();
|
|
||||||
if(curl)
|
|
||||||
{
|
|
||||||
CURLcode res;
|
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, address.c_str());
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);
|
|
||||||
res = curl_easy_perform(curl);
|
|
||||||
if (res != CURLE_OK)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "curl_easy_perform() failed: %s\n",curl_easy_strerror(res));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
curl_easy_cleanup(curl);
|
|
||||||
|
|
||||||
}
|
|
||||||
return input_data(buffer, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char* argv[]) {
|
|
||||||
Input input;
|
|
||||||
if (argc > 1) {
|
|
||||||
input = download(argv[1]);
|
|
||||||
} else {
|
|
||||||
input = input_data(cin, true);
|
|
||||||
}
|
|
||||||
const auto bins = make_histogramm(input.numbers, input.bin_count);
|
|
||||||
show_histogram_svg(bins);
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
#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 svg_rect(double x, double y, double width, double height, string colour = "black", string fill = "black")
|
|
||||||
{
|
|
||||||
cout << "<rect x='"<<x<<"' y='"<<y<<"' width='"<<width<<"' height='"<<height<<"' stroke = '"<<colour <<"' fill = '"<<fill<<"' />";
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
show_histogram_svg(const vector<size_t>& bins)
|
|
||||||
{
|
|
||||||
const auto IMAGE_WIDTH = 400;
|
|
||||||
const auto IMAGE_HEIGHT = 300;
|
|
||||||
const auto TEXT_LEFT = 20;
|
|
||||||
const auto TEXT_BASELINE = 20;
|
|
||||||
const auto TEXT_WIDTH = 50;
|
|
||||||
const auto BIN_HEIGHT = 30;
|
|
||||||
const auto BLOCK_WIDTH = 10;
|
|
||||||
const auto MAX_WIDTH = IMAGE_WIDTH-TEXT_WIDTH;
|
|
||||||
double top = 0;
|
|
||||||
double max_count = bins[0];
|
|
||||||
for (size_t i = 0; i < bins.size(); i++)
|
|
||||||
{
|
|
||||||
if (bins[i] > max_count)
|
|
||||||
max_count = bins[i];
|
|
||||||
}
|
|
||||||
svg_begin(400, 300);
|
|
||||||
for (size_t bin : bins)
|
|
||||||
{
|
|
||||||
const double bin_width = (IMAGE_WIDTH - TEXT_WIDTH)*(bin/max_count);
|
|
||||||
svg_text(TEXT_LEFT, top + TEXT_BASELINE, to_string(bin));
|
|
||||||
svg_rect(TEXT_WIDTH, top, bin_width, BIN_HEIGHT, "#DAF7A6", "#33DDFF");
|
|
||||||
top += BIN_HEIGHT;
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
#ifndef SVG_H_INCLUDED
|
|
||||||
#define SVG_H_INCLUDED
|
|
||||||
|
|
||||||
void
|
|
||||||
show_histogram_svg(const std::vector<size_t>& bins);
|
|
||||||
|
|
||||||
#endif // SVG_H_INCLUDED
|
|
@ -1,18 +1,20 @@
|
|||||||
#include <math.h>
|
|
||||||
#include <iostream>
|
|
||||||
#include <conio.h>
|
|
||||||
#include <vector>
|
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
void show_histogramm(vector<size_t>bins)
|
void show_histogram_text(vector <size_t> bins, size_t bin_count) {
|
||||||
{
|
|
||||||
for (size_t i = 0; i < bins.size(); i++)
|
for (size_t i = 0; i < bin_count; i++) {
|
||||||
{
|
if (bins[i] < 100) {
|
||||||
|
cout << " ";
|
||||||
|
}
|
||||||
|
if (bins[i] < 10) {
|
||||||
|
cout << " ";
|
||||||
|
}
|
||||||
cout << bins[i] << "|";
|
cout << bins[i] << "|";
|
||||||
for (size_t j = 0; j < bins[i]; j++)
|
for (size_t j = 0; j < bins[i]; j++) {
|
||||||
cout << "*";
|
cout << "*";
|
||||||
cout << endl;
|
|
||||||
}
|
}
|
||||||
return;
|
cout << "\n";
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,8 +1,3 @@
|
|||||||
#ifndef TEXT_H_INCLUDED
|
#include <vector>
|
||||||
#define TEXT_H_INCLUDED
|
std::vector<size_t>
|
||||||
|
show_histogram_text(std::vector <size_t> bins, size_t bin_count);
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
void show_histogramm(std::vector<size_t>bins);
|
|
||||||
|
|
||||||
#endif // TEXT_H_INCLUDED
|
|
@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_project_file>
|
|
||||||
<FileVersion major="1" minor="6" />
|
|
||||||
<Project>
|
|
||||||
<Option title="unitest" />
|
|
||||||
<Option pch_mode="2" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Build>
|
|
||||||
<Target title="Debug">
|
|
||||||
<Option output="bin/Debug/unitest" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj/Debug/" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-g" />
|
|
||||||
</Compiler>
|
|
||||||
</Target>
|
|
||||||
<Target title="Release">
|
|
||||||
<Option output="bin/Release/unitest" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj/Release/" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-O2" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add option="-s" />
|
|
||||||
</Linker>
|
|
||||||
</Target>
|
|
||||||
</Build>
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-Wall" />
|
|
||||||
<Add option="-fexceptions" />
|
|
||||||
</Compiler>
|
|
||||||
<Unit filename="doctest.h" />
|
|
||||||
<Unit filename="histogram.cpp" />
|
|
||||||
<Unit filename="histogram_internal.h" />
|
|
||||||
<Unit filename="unitest.cpp" />
|
|
||||||
<Extensions>
|
|
||||||
<lib_finder disable_auto="1" />
|
|
||||||
</Extensions>
|
|
||||||
</Project>
|
|
||||||
</CodeBlocks_project_file>
|
|
@ -1,53 +0,0 @@
|
|||||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
|
||||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
|
||||||
#include "doctest.h"
|
|
||||||
#include "histogram_internal.h"
|
|
||||||
#include <vector>
|
|
||||||
#include <iostream>
|
|
||||||
#define DOCTEST_CONFIG_NO_MULTITHREADING
|
|
||||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
|
||||||
#include "doctest.h"
|
|
||||||
#include "histogram_internal.h"
|
|
||||||
|
|
||||||
TEST_CASE("distinct positive numbers")
|
|
||||||
{
|
|
||||||
double min = 0;
|
|
||||||
double max = 0;
|
|
||||||
find_minmax({1, 2}, min, max);
|
|
||||||
CHECK(min == 1);
|
|
||||||
CHECK(max == 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("vector with one element")
|
|
||||||
{
|
|
||||||
double min = 0;
|
|
||||||
double max = 0;
|
|
||||||
find_minmax({1}, min, max);
|
|
||||||
CHECK(min == 1);
|
|
||||||
CHECK(max == 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("vector with same elements")
|
|
||||||
{
|
|
||||||
double min = 0;
|
|
||||||
double max = 0;
|
|
||||||
find_minmax({2,2,2}, min, max);
|
|
||||||
CHECK(min == 2);
|
|
||||||
CHECK(max == 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("void vector")
|
|
||||||
{
|
|
||||||
double min = 3;
|
|
||||||
double max = 2;
|
|
||||||
std::vector<double> numbers {};
|
|
||||||
bool check = find_minmax(numbers, min, max);
|
|
||||||
CHECK(check == true);
|
|
||||||
}
|
|
||||||
TEST_CASE("distinct negative numbers") {
|
|
||||||
double min = 0;
|
|
||||||
double max = 0;
|
|
||||||
find_minmax({-1, -2}, min, max);
|
|
||||||
CHECK(min == -2);
|
|
||||||
CHECK(max == -1);
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
# depslib dependency file v1.0
|
|
||||||
1686063069 source:c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\histogram.cpp
|
|
||||||
<math.h>
|
|
||||||
<iostream>
|
|
||||||
<conio.h>
|
|
||||||
<vector>
|
|
||||||
"histogram.h"
|
|
||||||
"histogram_internal.h"
|
|
||||||
|
|
||||||
1685970924 c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\histogram.h
|
|
||||||
<vector>
|
|
||||||
|
|
||||||
1685970476 source:c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\unitest.cpp
|
|
||||||
"doctest.h"
|
|
||||||
"histogram_internal.h"
|
|
||||||
<vector>
|
|
||||||
<iostream>
|
|
||||||
"doctest.h"
|
|
||||||
"histogram_internal.h"
|
|
||||||
|
|
||||||
1685861557 c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\doctest.h
|
|
||||||
<signal.h>
|
|
||||||
<ciso646>
|
|
||||||
<cstddef>
|
|
||||||
<ostream>
|
|
||||||
<istream>
|
|
||||||
<type_traits>
|
|
||||||
"doctest_fwd.h"
|
|
||||||
<ctime>
|
|
||||||
<cmath>
|
|
||||||
<climits>
|
|
||||||
<math.h>
|
|
||||||
<new>
|
|
||||||
<cstdio>
|
|
||||||
<cstdlib>
|
|
||||||
<cstring>
|
|
||||||
<limits>
|
|
||||||
<utility>
|
|
||||||
<fstream>
|
|
||||||
<sstream>
|
|
||||||
<iostream>
|
|
||||||
<algorithm>
|
|
||||||
<iomanip>
|
|
||||||
<vector>
|
|
||||||
<atomic>
|
|
||||||
<mutex>
|
|
||||||
<set>
|
|
||||||
<map>
|
|
||||||
<unordered_set>
|
|
||||||
<exception>
|
|
||||||
<stdexcept>
|
|
||||||
<csignal>
|
|
||||||
<cfloat>
|
|
||||||
<cctype>
|
|
||||||
<cstdint>
|
|
||||||
<string>
|
|
||||||
<sys/types.h>
|
|
||||||
<unistd.h>
|
|
||||||
<sys/sysctl.h>
|
|
||||||
<AfxWin.h>
|
|
||||||
<windows.h>
|
|
||||||
<io.h>
|
|
||||||
<sys/time.h>
|
|
||||||
<unistd.h>
|
|
||||||
|
|
||||||
1685970915 c:\users\nn110\onedrive\Ðàáî÷èé ñòîë\lab3\histogram_internal.h
|
|
||||||
<vector>
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_layout_file>
|
|
||||||
<FileVersion major="1" minor="0" />
|
|
||||||
<ActiveTarget name="Debug" />
|
|
||||||
<File name="histogram_internal.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="216" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="doctest.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="110023" topLine="2364" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="histogram.cpp" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="245" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
<File name="unitest.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
|
||||||
<Cursor>
|
|
||||||
<Cursor1 position="895" topLine="0" />
|
|
||||||
</Cursor>
|
|
||||||
</File>
|
|
||||||
</CodeBlocks_layout_file>
|
|
Загрузка…
Ссылка в новой задаче