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 Homework_STL/Homework_STL.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.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework_STL", "Homework_STL\Homework_STL.vcxproj", "{10BC67F6-E670-4CC5-B009-66534138C23D}"
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
{10BC67F6-E670-4CC5-B009-66534138C23D}.Debug|x64.ActiveCfg = Debug|x64
{10BC67F6-E670-4CC5-B009-66534138C23D}.Debug|x64.Build.0 = Debug|x64
{10BC67F6-E670-4CC5-B009-66534138C23D}.Debug|x86.ActiveCfg = Debug|Win32
{10BC67F6-E670-4CC5-B009-66534138C23D}.Debug|x86.Build.0 = Debug|Win32
{10BC67F6-E670-4CC5-B009-66534138C23D}.Release|x64.ActiveCfg = Release|x64
{10BC67F6-E670-4CC5-B009-66534138C23D}.Release|x64.Build.0 = Release|x64
{10BC67F6-E670-4CC5-B009-66534138C23D}.Release|x86.ActiveCfg = Release|Win32
{10BC67F6-E670-4CC5-B009-66534138C23D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {609D2169-0704-4381-9721-F22E05813CA4}
EndGlobalSection
EndGlobal
43 changes: 43 additions & 0 deletions Homework_STL/Homework_STL/Color.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#pragma once

enum colors {
white,
yellow,
azure,
red,
blue,
violet,
green,
violet_dark,
blue_dark,
gray_dark,
};

class color {
private:
colors type;

public:
color() : type(colors::white) {};
color(colors _type) : type(_type) {};
friend std::ostream& operator << (std::ostream& os, const color& color) {
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
color.type == white ? SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) :
color.type == yellow ? SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY) :
color.type == azure ? SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_INTENSITY) :
color.type == red ? SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_INTENSITY) :
color.type == blue ? SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE | FOREGROUND_INTENSITY) :
color.type == violet ? SetConsoleTextAttribute(hStdout, FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE) :
color.type == green ? SetConsoleTextAttribute(hStdout, FOREGROUND_GREEN | FOREGROUND_INTENSITY) :
color.type == violet_dark ? SetConsoleTextAttribute(hStdout, FOREGROUND_RED | FOREGROUND_INTENSITY | FOREGROUND_BLUE) :
color.type == blue_dark ? SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE | FOREGROUND_GREEN) :
color.type == gray_dark ? SetConsoleTextAttribute(hStdout, FOREGROUND_INTENSITY) :
NULL;
return os;
}

std::string print(std::string word) {
std::cout << color(type) << word << color();
return "";
}
};
140 changes: 140 additions & 0 deletions Homework_STL/Homework_STL/Homework_STL.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<?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>{10bc67f6-e670-4cc5-b009-66534138c23d}</ProjectGuid>
<RootNamespace>HomeworkSTL</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="Main_STL.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Color.h" />
<ClInclude Include="Menu.h" />
<ClInclude Include="Tasker.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
33 changes: 33 additions & 0 deletions Homework_STL/Homework_STL/Homework_STL.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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_STL.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Menu.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="Tasker.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="Color.h">
<Filter>Файлы заголовков</Filter>
</ClInclude>
</ItemGroup>
</Project>
76 changes: 76 additions & 0 deletions Homework_STL/Homework_STL/Main_STL.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#include "Menu.h"
#include "Tasker.h"

int main() {
srand(time(NULL));
Answer answer;
Menu menu;
Tasker tasker;
menu.Blinking(FALSE);

while (true) {
answer = menu.Enable();
menu.reset_iKey();
if (answer.iKey == KEY_EXIT || answer.choose == ITEMS::exit) {
system("cls");
std::cout << color(red).print("Exit program!");
_getch();
break;
}
else if (answer.choose == ITEMS::btn1) {
system("cls");
tasker.test(answer.iterator);
_getch();
system("cls");
}
else if (answer.choose == ITEMS::btn2) {
if (answer.iterator == 0 || answer.iterator == 1 || answer.iterator == 3) {
system("cls");
tasker.analysis(answer.iterator);
_getch();
system("cls");
}
else if (answer.iterator == 2) {
while (true) {
menu.type_switch(TYPE::stack);
system("cls");
answer = menu.Enable();
if (answer.iKey == KEY_EXIT || answer.choose == ITEMS::exit) {
system("cls");
std::cout << color(red).print("Exit stack menu!");
menu.type_switch(TYPE::main);
break;
}
else if (answer.choose == ITEMS::btn1) {
system("cls");
std::cout << color(yellow).print("Add element");
tasker.t3.push(answer.value);
_getch();
}
else if (answer.choose == ITEMS::btn2) {
system("cls");
if (tasker.t3.stack.empty()) { std::cout << color(yellow).print("Stack is clear!"); }
else { std::cout << color(yellow) << "Element deleted: " << color(azure) << tasker.t3.stack.top() << color(); }
tasker.t3.pop();
_getch();
}
else if (answer.choose == ITEMS::btn3) {
system("cls");
tasker.t3.print();
_getch();
}
else if (answer.choose == ITEMS::btn4) {
system("cls");
std::cout << color(yellow).print("Cleared!");
tasker.t3.clear();
_getch();
}
}
_getch();
system("cls");
}
}
}
return 0;
}

Loading