Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions sem2/VasilevAD/hw3/hw3.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.37111.16 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hw3", "hw3\hw3.vcxproj", "{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}"
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
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Debug|x64.ActiveCfg = Debug|x64
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Debug|x64.Build.0 = Debug|x64
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Debug|x86.ActiveCfg = Debug|Win32
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Debug|x86.Build.0 = Debug|Win32
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Release|x64.ActiveCfg = Release|x64
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Release|x64.Build.0 = Release|x64
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Release|x86.ActiveCfg = Release|Win32
{A4F7A12F-6FEF-44BC-9AA1-C02D737B9882}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {75CD3F54-6B0C-46D5-AA37-99268B6ACA91}
EndGlobalSection
EndGlobal
131 changes: 131 additions & 0 deletions sem2/VasilevAD/hw3/hw3/hw3.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?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>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{a4f7a12f-6fef-44bc-9aa1-c02d737b9882}</ProjectGuid>
<RootNamespace>hw3</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>
<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>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
22 changes: 22 additions & 0 deletions sem2/VasilevAD/hw3/hw3/hw3.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -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="main.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions sem2/VasilevAD/hw3/hw3/hw3.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
6 changes: 6 additions & 0 deletions sem2/VasilevAD/hw3/hw3/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Hello world
C++ programming is fun
Lambda expressions
STL algorithms
Short
A very long string just for testing purposes
115 changes: 115 additions & 0 deletions sem2/VasilevAD/hw3/hw3/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#include <algorithm>
#include <fstream>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>


int main() {
std::ifstream in_file("input.txt");
if (!in_file.is_open()) {
std::cerr << "Failed to open input.txt\n";
return 1;
}

std::vector<std::string> original_lines;
std::string current_line;
while (std::getline(in_file, current_line)) {
original_lines.push_back(current_line);
}
in_file.close();

// ���� ����������
size_t length_threshold = 0;
std::cout << "Enter the minimum string length threshold: ";
std::cin >> length_threshold;

std::string search_word;
std::cout << "Enter the word to search for: ";
std::cin >> search_word;

std::ofstream out_file("output.txt");
if (!out_file.is_open()) {
std::cerr << "Failed to open output.txt\n";
return 1;
}

// ������ � ������� ����������
std::vector<std::string> working_lines = original_lines;


printVectorString(out_file, working_lines, "Original strings");

// �������� �������� ����� (������ � �������� �� ��������)
working_lines.erase(std::remove_if(working_lines.begin(), working_lines.end(),
[length_threshold](const std::string& s) {
return s.length() < length_threshold; }),
working_lines.end());

printVectorString(out_file, working_lines, "After removing short strings");

// ������ ���� ��������
std::for_each(working_lines.begin(), working_lines.end(), [](std::string& s) {
std::replace(s.begin(), s.end(), ' ', '_');
});

printVectorString(out_file, working_lines, "After replacing spaces with '_'");

// ����� ������
auto found_it = std::find_if(working_lines.begin(), working_lines.end(),
[&search_word](const std::string& s) {
return s.find(search_word) != std::string::npos;
});

out_file << "--- Search result for word '" << search_word << "' ---\n";
if (found_it != working_lines.end()) {
out_file << "Found in string: " << *found_it << "\n\n";
} else {
out_file << "Word not found.\n\n";
}

// ������� ���������� ��������
int char_count = std::accumulate(
working_lines.begin(), working_lines.end(), 0,
[](int current_sum, const std::string& s) {
return current_sum + std::count_if(s.begin(), s.end(),
[](char c) { return c != '_'; });
});

out_file << "--- Total characters excluding '_' ---\n";
out_file << char_count << "\n\n";

// �������� ������ �������
std::vector<int> lengths;
lengths.reserve(working_lines.size());
std::transform(
working_lines.begin(), working_lines.end(), std::back_inserter(lengths),
[](const std::string& s) { return static_cast<int>(s.length()); });

printVectorInt(out_file, lengths, "Lengths of strings");

out_file.close();
std::cout << "Processing complete. Results are saved in output.txt\n";

return 0;
}


void printVectorString(std::ofstream& out, const std::vector<std::string>& vec,
const std::string& title) {
out << "--- " << title << " ---\n";
for (const auto& str : vec) {
out << str << "\n";
}
out << "\n";
}

void printVectorInt(std::ofstream& out, const std::vector<int>& vec,
const std::string& title) {
out << "--- " << title << " ---\n";
for (const auto& val : vec) {
out << val << " ";
}
out << "\n\n";
}
31 changes: 31 additions & 0 deletions sem2/VasilevAD/hw3/hw3/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--- Original strings ---
Hello world
C++ programming is fun
Lambda expressions
STL algorithms
Short
A very long string just for testing purposes

--- After removing short strings ---
Hello world
C++ programming is fun
Lambda expressions
STL algorithms
A very long string just for testing purposes

--- After replacing spaces with '_' ---
Hello_world
C++_programming_is_fun
Lambda_expressions
STL_algorithms
A_very_long_string_just_for_testing_purposes

--- Search result for word 'fun' ---
Found in string: C++_programming_is_fun

--- Total characters excluding '_' ---
96

--- Lengths of strings ---
11 22 18 14 44

11 changes: 11 additions & 0 deletions sem2/VasilevAD/hw3/hw3/x64/Debug/hw3.exe.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\Weyd\Desktop\hw3\x64\Debug\hw3.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>
Binary file added sem2/VasilevAD/hw3/hw3/x64/Debug/hw3.ilk
Binary file not shown.
19 changes: 19 additions & 0 deletions sem2/VasilevAD/hw3/hw3/x64/Debug/hw3.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
 main.cpp
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\numeric(33,26): warning C4244: =: преобразование "__int64" в "_Ty", возможна потеря данных
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\numeric(33,26): warning C4244: with
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\numeric(33,26): warning C4244: [
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\numeric(33,26): warning C4244: _Ty=int
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\numeric(33,26): warning C4244: ]
(компиляция исходного файла "main.cpp")
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include\numeric(33,26):
контекст создания экземпляра шаблона (сначала самый старый)
C:\Users\Weyd\Desktop\hw3\hw3\main.cpp(94,25):
выполняется компиляция ссылки на экземпляр шаблон функции "_Ty std::accumulate<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>>>,int,main::<lambda_4>>(const _InIt,const _InIt,_Ty,_Fn)"
with
[
_Ty=int,
_InIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<std::string>>>,
_Fn=main::<lambda_4>
]

hw3.vcxproj -> C:\Users\Weyd\Desktop\hw3\x64\Debug\hw3.exe
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions sem2/VasilevAD/hw3/hw3/x64/Debug/hw3.tlog/Cl.items.tlog
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:\Users\Weyd\Desktop\hw3\hw3\main.cpp;C:\Users\Weyd\Desktop\hw3\hw3\x64\Debug\main.obj
2 changes: 2 additions & 0 deletions sem2/VasilevAD/hw3/hw3/x64/Debug/hw3.tlog/hw3.lastbuildstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.44.35207:TargetPlatformVersion=10.0.26100.0:
Debug|x64|C:\Users\Weyd\Desktop\hw3\|
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
^C:\USERS\WEYD\DESKTOP\HW3\HW3\X64\DEBUG\MAIN.OBJ
C:\Users\Weyd\Desktop\hw3\hw3\x64\Debug\hw3.ilk
Binary file not shown.
Binary file added sem2/VasilevAD/hw3/hw3/x64/Debug/main.obj
Binary file not shown.
Binary file added sem2/VasilevAD/hw3/hw3/x64/Debug/vc143.idb
Binary file not shown.
Binary file added sem2/VasilevAD/hw3/hw3/x64/Debug/vc143.pdb
Binary file not shown.
Binary file added sem2/VasilevAD/hw3/x64/Debug/hw3.exe
Binary file not shown.
Binary file added sem2/VasilevAD/hw3/x64/Debug/hw3.pdb
Binary file not shown.