From 0c724810450a6c3f3c3a329fcc81e42f1d80a84a Mon Sep 17 00:00:00 2001 From: Vladimir Protsenko Date: Tue, 8 Sep 2020 16:02:29 +0400 Subject: [PATCH] Added first example. --- examples/lab1/APlusBLib/.gitignore | 362 ++++++++++++++++++ examples/lab1/APlusBLib/APlusBLib.cpp | 10 + examples/lab1/APlusBLib/APlusBLib.h | 13 + examples/lab1/APlusBLib/APlusBLib.sln | 31 ++ examples/lab1/APlusBLib/APlusBLib.vcxproj | 169 ++++++++ .../lab1/APlusBLib/APlusBLib.vcxproj.filters | 30 ++ examples/lab1/APlusBLib/cpp.hint | 2 + examples/lab1/ConsoleApplication/.gitignore | 362 ++++++++++++++++++ .../ConsoleApplication/ConsoleApplication.cpp | 92 +++++ .../ConsoleApplication/ConsoleApplication.sln | 31 ++ .../ConsoleApplication.vcxproj | 150 ++++++++ .../ConsoleApplication.vcxproj.filters | 22 ++ 12 files changed, 1274 insertions(+) create mode 100644 examples/lab1/APlusBLib/.gitignore create mode 100644 examples/lab1/APlusBLib/APlusBLib.cpp create mode 100644 examples/lab1/APlusBLib/APlusBLib.h create mode 100644 examples/lab1/APlusBLib/APlusBLib.sln create mode 100644 examples/lab1/APlusBLib/APlusBLib.vcxproj create mode 100644 examples/lab1/APlusBLib/APlusBLib.vcxproj.filters create mode 100644 examples/lab1/APlusBLib/cpp.hint create mode 100644 examples/lab1/ConsoleApplication/.gitignore create mode 100644 examples/lab1/ConsoleApplication/ConsoleApplication.cpp create mode 100644 examples/lab1/ConsoleApplication/ConsoleApplication.sln create mode 100644 examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj create mode 100644 examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj.filters diff --git a/examples/lab1/APlusBLib/.gitignore b/examples/lab1/APlusBLib/.gitignore new file mode 100644 index 0000000..1ee5385 --- /dev/null +++ b/examples/lab1/APlusBLib/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## 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/ +[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 diff --git a/examples/lab1/APlusBLib/APlusBLib.cpp b/examples/lab1/APlusBLib/APlusBLib.cpp new file mode 100644 index 0000000..066e5fc --- /dev/null +++ b/examples/lab1/APlusBLib/APlusBLib.cpp @@ -0,0 +1,10 @@ +// APlusBLib.cpp : Определяет экспортируемые функции для DLL. + +#include "APlusBLib.h" + + +// Пример экспортированной функции. +APLUSBLIB_API int APlusB(int a, int b) +{ + return a + b; +} \ No newline at end of file diff --git a/examples/lab1/APlusBLib/APlusBLib.h b/examples/lab1/APlusBLib/APlusBLib.h new file mode 100644 index 0000000..cc74956 --- /dev/null +++ b/examples/lab1/APlusBLib/APlusBLib.h @@ -0,0 +1,13 @@ +// Приведенный ниже блок ifdef — это стандартный метод создания макросов, упрощающий процедуру +// экспорта из библиотек DLL. Все файлы данной DLL скомпилированы с использованием символа APLUSBLIB_EXPORTS +// Символ, определенный в командной строке. Этот символ не должен быть определен в каком-либо проекте, +// использующем данную DLL. Благодаря этому любой другой проект, исходные файлы которого включают данный файл, видит +// функции APLUSBLIB_API как импортированные из DLL, тогда как данная DLL видит символы, +// определяемые данным макросом, как экспортированные. +#ifdef APLUSBLIB_EXPORTS +#define APLUSBLIB_API __declspec(dllexport) +#else +#define APLUSBLIB_API __declspec(dllimport) +#endif + +extern "C" APLUSBLIB_API int APlusB(int a, int b); \ No newline at end of file diff --git a/examples/lab1/APlusBLib/APlusBLib.sln b/examples/lab1/APlusBLib/APlusBLib.sln new file mode 100644 index 0000000..c24f55d --- /dev/null +++ b/examples/lab1/APlusBLib/APlusBLib.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APlusBLib", "APlusBLib.vcxproj", "{E244EB10-FEAB-4F71-A468-47FC13D2A15A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Debug|x64.ActiveCfg = Debug|x64 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Debug|x64.Build.0 = Debug|x64 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Debug|x86.ActiveCfg = Debug|Win32 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Debug|x86.Build.0 = Debug|Win32 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Release|x64.ActiveCfg = Release|x64 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Release|x64.Build.0 = Release|x64 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Release|x86.ActiveCfg = Release|Win32 + {E244EB10-FEAB-4F71-A468-47FC13D2A15A}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6C12E51E-9804-49F2-94DD-68FF48EE826A} + EndGlobalSection +EndGlobal diff --git a/examples/lab1/APlusBLib/APlusBLib.vcxproj b/examples/lab1/APlusBLib/APlusBLib.vcxproj new file mode 100644 index 0000000..8472111 --- /dev/null +++ b/examples/lab1/APlusBLib/APlusBLib.vcxproj @@ -0,0 +1,169 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {e244eb10-feab-4f71-a468-47fc13d2a15a} + APlusBLib + 10.0 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + APlusBLib + + + false + APlusBLib + + + true + APlusBLib + + + false + APlusBLib + + + + Level3 + true + WIN32;_DEBUG;APLUSBLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;APLUSBLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + NotUsing + pch.h + + + Windows + true + true + true + false + + + + + Level3 + true + _DEBUG;APLUSBLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;APLUSBLIB_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/lab1/APlusBLib/APlusBLib.vcxproj.filters b/examples/lab1/APlusBLib/APlusBLib.vcxproj.filters new file mode 100644 index 0000000..6d17093 --- /dev/null +++ b/examples/lab1/APlusBLib/APlusBLib.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Файлы заголовков + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/examples/lab1/APlusBLib/cpp.hint b/examples/lab1/APlusBLib/cpp.hint new file mode 100644 index 0000000..a947a92 --- /dev/null +++ b/examples/lab1/APlusBLib/cpp.hint @@ -0,0 +1,2 @@ +#define APLUSBLIB_API __declspec(dllexport) +#define APLUSBLIB_API __declspec(dllimport) diff --git a/examples/lab1/ConsoleApplication/.gitignore b/examples/lab1/ConsoleApplication/.gitignore new file mode 100644 index 0000000..1ee5385 --- /dev/null +++ b/examples/lab1/ConsoleApplication/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## 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/ +[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 diff --git a/examples/lab1/ConsoleApplication/ConsoleApplication.cpp b/examples/lab1/ConsoleApplication/ConsoleApplication.cpp new file mode 100644 index 0000000..b1b8718 --- /dev/null +++ b/examples/lab1/ConsoleApplication/ConsoleApplication.cpp @@ -0,0 +1,92 @@ +// ConsoleApplication.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. +// + +#include +#include +#include "APlusBLib.h" + +const char EOLN = '\n'; +const char YES_CHAR = 'Y'; +const char NO_CHAR = 'N'; +const int LEFT_BOUND = -1000000000; +const int RIGHT_BOUND = +1000000000; +const std::string ABOUT_MESSAGE = "A+B"; +const std::string CONTINUE_MESSAGE = +"Continue? (Y/N)>"; +const std::string INCORRECT_MESSAGE = +"Input is incorrect. Try again>"; +const std::string INPUT_MESSAGE = "Input an integer>"; +const std::string OUT_OF_BOUNDS_MESSAGE = +"This number is out of bounds"; +const std::string OUTPUT_MESSAGE = "Result: "; +const std::string SKIP_CHARACTERS = " "; + +void ClearInputStream(std::istream& in) +{ + in.clear(); + while (in.peek() != EOLN && in.peek() != EOF) + { + in.get(); + } +} + +int Seek(std::istream& in) +{ + while (in.peek() != EOLN && SKIP_CHARACTERS.find((char)in.peek()) != std::string::npos) + { + in.get(); + } + return in.peek(); +} + +bool CheckBounds(int n) +{ + bool ok = (LEFT_BOUND <= n && n <= RIGHT_BOUND); + if (!ok) + { + std::cout << OUT_OF_BOUNDS_MESSAGE << " [" << LEFT_BOUND << ", " << RIGHT_BOUND << "]" << std::endl; + } + return ok; +} + +int ReadInt(std::istream& in) +{ + std::cout << INPUT_MESSAGE; + int ans; + in >> ans; + while (!in || Seek(in) != EOLN || !CheckBounds(ans)) + { + ClearInputStream(in); + std::cout << INCORRECT_MESSAGE; + in >> ans; + } + return ans; +} + +bool NeedContinue(std::istream& in) +{ + std::cout << CONTINUE_MESSAGE; + char ans; + in >> ans; + while (!in || Seek(in) != EOLN || ans != YES_CHAR && ans != NO_CHAR) + { + ClearInputStream(in); + std::cout << INCORRECT_MESSAGE; + in >> ans; + } + return ans == YES_CHAR; +} + +int main() +{ + std::cout << ABOUT_MESSAGE << std::endl; + bool cont = true; + while (cont) + { + int a = ReadInt(std::cin); + int b = ReadInt(std::cin); + std::cout << OUTPUT_MESSAGE << APlusB(a, b) << std::endl; + cont = NeedContinue(std::cin); + } + return 0; +} \ No newline at end of file diff --git a/examples/lab1/ConsoleApplication/ConsoleApplication.sln b/examples/lab1/ConsoleApplication/ConsoleApplication.sln new file mode 100644 index 0000000..59a7e6b --- /dev/null +++ b/examples/lab1/ConsoleApplication/ConsoleApplication.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30413.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication", "ConsoleApplication.vcxproj", "{E5738B18-F899-45C7-9B8F-C4503C83F3B8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Debug|x64.ActiveCfg = Debug|x64 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Debug|x64.Build.0 = Debug|x64 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Debug|x86.ActiveCfg = Debug|Win32 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Debug|x86.Build.0 = Debug|Win32 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Release|x64.ActiveCfg = Release|x64 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Release|x64.Build.0 = Release|x64 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Release|x86.ActiveCfg = Release|Win32 + {E5738B18-F899-45C7-9B8F-C4503C83F3B8}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E7C1929E-CD05-439F-9111-B700DB3BEF1E} + EndGlobalSection +EndGlobal diff --git a/examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj b/examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj new file mode 100644 index 0000000..e9db79d --- /dev/null +++ b/examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj @@ -0,0 +1,150 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {e5738b18-f899-45c7-9b8f-c4503c83f3b8} + ConsoleApplication + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)../APlusBLib;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)..\APlusBLib\Release;%(AdditionalLibraryDirectories) + APlusBLib.lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj.filters b/examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj.filters new file mode 100644 index 0000000..64d82a7 --- /dev/null +++ b/examples/lab1/ConsoleApplication/ConsoleApplication.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file