diff --git a/.gitignore b/.gitignore index d4fb2818..deb0abd6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,41 +1,8 @@ -# Prerequisites -*.d +# Игнорируем всё -# Compiled Object files -*.slo -*.lo -*.o -*.obj +# Но исключаем файлы .txt и .cpp +!*.txt +!*.cpp -# Precompiled Headers -*.gch -*.pch - -# Linker files -*.ilk - -# Debugger Files -*.pdb - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - -# debug information files -*.dwo +# Также исключаем сам .gitignore (чтобы он попал в репозиторий) +!.gitignore \ No newline at end of file diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1.sln b/sem2/SuvorovIA/mini_hw_1/mini_hw_1.sln deleted file mode 100644 index 4ee5f821..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1.sln +++ /dev/null @@ -1,44 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.14.36202.13 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mini_hw_1", "mini_hw_1\mini_hw_1.vcxproj", "{8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vec_3_test", "vec_3_test\vec_3_test.vcxproj", "{E84A21C2-CE07-487D-BB14-9DF1CE0383C8}" - ProjectSection(ProjectDependencies) = postProject - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A} = {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A} - EndProjectSection -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 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Debug|x64.ActiveCfg = Debug|x64 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Debug|x64.Build.0 = Debug|x64 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Debug|x86.ActiveCfg = Debug|Win32 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Debug|x86.Build.0 = Debug|Win32 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Release|x64.ActiveCfg = Release|x64 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Release|x64.Build.0 = Release|x64 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Release|x86.ActiveCfg = Release|Win32 - {8EB8EEAC-B56B-408C-BDE1-4142D0D7AC4A}.Release|x86.Build.0 = Release|Win32 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Debug|x64.ActiveCfg = Debug|x64 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Debug|x64.Build.0 = Debug|x64 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Debug|x86.ActiveCfg = Debug|Win32 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Debug|x86.Build.0 = Debug|Win32 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Release|x64.ActiveCfg = Release|x64 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Release|x64.Build.0 = Release|x64 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Release|x86.ActiveCfg = Release|Win32 - {E84A21C2-CE07-487D-BB14-9DF1CE0383C8}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {168D4678-D4ED-4C2D-BCB1-60C1D0F1D5C4} - EndGlobalSection -EndGlobal diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/Vec3Lib.cpp b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/Vec3Lib.cpp deleted file mode 100644 index f26ba57f..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/Vec3Lib.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#define VEC3LIBRARY_EXPORTS - -#include "pch.h" - -#include "Vec3Lib.h" - -Vec3::Vec3() { - x = 0; - y = 0; - z = 0; -} -Vec3::Vec3(float _x, float _y, float _z) { - x = _x; - y = _y; - z = _z; -} -Vec3::Vec3(const Vec3& other) { - x = other.x; - y = other.y; - z = other.z; -} -Vec3& Vec3::operator=(const Vec3& other) { - if (this != &other) { - x = other.x; - y = other.y; - z = other.z; - } - return *this; -} -Vec3 operator+(const Vec3& a, const Vec3& b) { - return Vec3(a.x + b.x, a.y + b.y, a.z + b.z); -} -Vec3 operator-(const Vec3& a, const Vec3& b) { - return Vec3(a.x - b.x, a.y - b.y, a.z - b.z); -} -Vec3 operator*(const Vec3& a, float value) { - return Vec3(a.x * value, a.y * value, a.z * value); -} -Vec3 operator*(float value, const Vec3& a) { - return Vec3(a.x * value, a.y * value, a.z * value); -} -float Vec3::length() const { return sqrt(x * x + y * y + z * z); } -void Vec3::normalize() { - float len = length(); - x = x / len; - y = y / len; - z = z / len; -} -Vec3 Vec3::normalized() const { - float len = length(); - return Vec3(x / len, y / len, z / len); -} -float Vec3::dot(Vec3& other) const { - return x * other.x + y * other.y + z * other.z; -} -Vec3 Vec3::cross(Vec3& other) const { - return Vec3(y * other.z - z * other.y, z * other.x - x * other.z, - x * other.y - y * other.x); -} diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/Vec3Lib.h b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/Vec3Lib.h deleted file mode 100644 index 6a6e1cd0..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/Vec3Lib.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#ifdef VEC3LIBRARY_EXPORTS -#define VEC3LIB_API __declspec(dllexport) -#else -#define VEC3LIB_API __declspec(dllimport) -#endif - -#include - -struct VEC3LIB_API Vec3 { - float x; - float y; - float z; - - Vec3(); - Vec3(float x, float y, float z); - Vec3(const Vec3& other); - Vec3& operator=(const Vec3& other); - - float length() const; - void normalize(); - Vec3 normalized() const; - float dot(Vec3& other) const; - Vec3 cross(Vec3& other) const; -}; - -inline std::ostream& operator<<(std::ostream& os, const Vec3& v) { - os << "(" << v.x << ", " << v.y << ", " << v.z << ")"; - return os; -} - -VEC3LIB_API Vec3 operator+(const Vec3& a, const Vec3& b); -VEC3LIB_API Vec3 operator-(const Vec3& a, const Vec3& b); -VEC3LIB_API Vec3 operator*(const Vec3& a, float value); -VEC3LIB_API Vec3 operator*(float value, const Vec3& a); diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/dllmain.cpp b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/dllmain.cpp deleted file mode 100644 index b5a6f76d..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/dllmain.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "pch.h" - -BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, - LPVOID lpReserved) { - switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/framework.h b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/framework.h deleted file mode 100644 index 8aae4cf4..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/framework.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#define WIN32_LEAN_AND_MEAN -#include diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/mini_hw_1.vcxproj b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/mini_hw_1.vcxproj deleted file mode 100644 index 9942b4bf..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/mini_hw_1.vcxproj +++ /dev/null @@ -1,157 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {8eb8eeac-b56b-408c-bde1-4142d0d7ac4a} - minihw1 - 10.0 - - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - DynamicLibrary - true - v143 - Unicode - - - DynamicLibrary - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;MINIHW1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - - - - - Level3 - true - true - true - WIN32;NDEBUG;MINIHW1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - - - - - Level3 - true - _DEBUG;MINIHW1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - - - - - Level3 - true - true - true - NDEBUG;MINIHW1_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - Use - pch.h - - - Windows - true - false - - - - - - - - - - - Create - Create - Create - Create - - - VEC3LIBRARY_EXPORTS;%(PreprocessorDefinitions) - - - - - - \ No newline at end of file diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/mini_hw_1.vcxproj.filters b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/mini_hw_1.vcxproj.filters deleted file mode 100644 index d2a7771c..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/mini_hw_1.vcxproj.filters +++ /dev/null @@ -1,39 +0,0 @@ - - - - - {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/sem2/SuvorovIA/mini_hw_1/mini_hw_1/pch.cpp b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/pch.cpp deleted file mode 100644 index bcb5590b..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/pch.h b/sem2/SuvorovIA/mini_hw_1/mini_hw_1/pch.h deleted file mode 100644 index d4c303f5..00000000 --- a/sem2/SuvorovIA/mini_hw_1/mini_hw_1/pch.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include -#include - -#include "framework.h" diff --git a/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.cpp b/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.cpp deleted file mode 100644 index ebf8ec5c..00000000 --- a/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#include "Vec3Lib.h" - -void test() { - Vec3 vector1(1, 2, 3); - Vec3 vector2(2, 5, 4); - Vec3 vector3(vector2); - - std::cout << "Векторы: " << vector1 << " " << vector2 << " " << vector3 - << std::endl; - std::cout << "Векторное произведение vector1 и vector3: " - << vector1.cross(vector3) << std::endl; - std::cout << "Скалярное произведение vector1 и vector2: " - << vector1.dot(vector2) << std::endl; - std::cout << "Длина vector1: " << vector1.length() << std::endl; - - vector2.normalize(); - std::cout << "Нормализованный vector2: " << vector2 << std::endl; - std::cout << "Нормализованный vector3: " << vector3.normalized() << std::endl; - - std::cout << "Сложение и вычитание векторов: " << (vector1 + vector2) << " " - << (vector2 - vector3) << std::endl; - std::cout << "Умножение вектора на скаляр: " << (vector1 * 2.4f) << std::endl; -} - -int main() { - test(); - return 0; -} diff --git a/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.vcxproj b/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.vcxproj deleted file mode 100644 index 7dfbf1c6..00000000 --- a/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.vcxproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {e84a21c2-ce07-487d-bb14-9df1ce0383c8} - vec3test - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - C:\Users\OMEN\Desktop\C++\Практика\Suvorov_cpp\sem2\SuvorovIA\mini_hw_1\mini_hw_1;%(AdditionalIncludeDirectories) - - - Console - true - C:\Users\OMEN\Desktop\C++\Практика\Suvorov_cpp\sem2\SuvorovIA\mini_hw_1\x64\Debug;%(AdditionalLibraryDirectories) - mini_hw_1.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - - - - - \ No newline at end of file diff --git a/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.vcxproj.filters b/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.vcxproj.filters deleted file mode 100644 index 48cf4bc0..00000000 --- a/sem2/SuvorovIA/mini_hw_1/vec_3_test/vec_3_test.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {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/sem2/SuvorovIA/mini_hw_2/mini_hw_2/constants.h b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/constants.h deleted file mode 100644 index 5a8e1594..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/constants.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CONSTANTS_H -#define CONSTANTS_H - -#include - -namespace Constants { -constexpr int METER = 100; -constexpr float GAMETIME = 60.f; -constexpr int SCREEN_HEIGHT = 960; -constexpr int SCREEN_WIDTH = 1280; -} // namespace Constants - -#endif diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/game_ganager.cpp b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/game_ganager.cpp deleted file mode 100644 index 4cc9dae2..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/game_ganager.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "game_manager.h" - -void GameManager::initialize() { - for (int i = 0; i < max_circles; i++) { - sf::CircleShape circle; - circle.setFillColor(sf::Color::Green); - circle.setRadius(50); - circle.setPosition(Utility::newCirclePosition()); - circles.emplace_back(circle); - } - - timer_font.loadFromFile("fonts/165-font.ttf"); - score_font.loadFromFile("fonts/Schiffbauer-Regular.otf"); - - timer_text.setFont(timer_font); - timer_text.setScale(2, 2); - timer_text.setPosition(SCREEN_WIDTH / 2, 20); - - score_text.setFont(score_font); - score_text.setScale(2, 2); - sf::FloatRect textBounds = score_text.getLocalBounds(); - score_text.setOrigin(textBounds.left + textBounds.width / 2, - textBounds.top + textBounds.height / 2); - score_text.setString("SCORE: " + std::to_string(score)); - score_text.setPosition(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100); - - enum class GameState { RUNNING, GAMEOVER }; - GameState state = GameState::RUNNING; - - hit_buffer.loadFromFile("audio/hit.wav"); - - hit_sound.setBuffer(hit_buffer); -} -void GameManager::startGame() { - sf::RenderWindow window(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT), - "OSU - made at home"); - state = GameState::RUNNING; - - while (window.isOpen()) { - sf::Event event; - while (window.pollEvent(event)) { - if (event.type == sf::Event::Closed) window.close(); - - if (event.type == sf::Event::MouseButtonPressed && - event.mouseButton.button == sf::Mouse::Left) { - sf::Vector2i mousePos = sf::Mouse::getPosition(window); - - bool is_found = false; - for (sf::CircleShape &circle : circles) { - if (circle.getGlobalBounds().contains(mousePos.x, mousePos.y)) { - circle.setPosition(Utility::newCirclePosition()); - score++; - score_text.setString("SCORE: " + std::to_string(score)); - hit_sound.play(); - is_found = true; - } - } - if (!is_found) { - time_left -= loose_points; - int_timer -= loose_points; - timer_text.setFillColor(sf::Color::Red); - } - } - - float deltaTime = gameTimer.restart().asSeconds(); - time_left -= deltaTime; - if (time_left <= 0) { - state = GameState::GAMEOVER; - score_text.setPosition(SCREEN_WIDTH / 2, SCREEN_WIDTH / 2); - break; - } - if (int_timer - (int)time_left >= 1) { - int_timer--; - timer_text.setString(std::to_string(int_timer)); - timer_text.setFillColor(sf::Color::White); - } - } - - window.clear(); - if (state == GameState::RUNNING) { - for (sf::CircleShape circle : circles) window.draw(circle); - window.draw(timer_text); - window.draw(score_text); - } - if (state == GameState::GAMEOVER) { - window.draw(score_text); - } - window.display(); - } -} diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/game_manager.h b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/game_manager.h deleted file mode 100644 index ac7883b8..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/game_manager.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include "constants.h" -#include "utils.h" - -using namespace Constants; - -class GameManager { - private: - sf::Clock gameTimer; - float time_left = Constants::GAMETIME; - int int_timer = time_left; - int score = 0; - int past = -1; - int loose_points = 5; - std::vector circles; - int max_circles = 5; - sf::Font timer_font; - sf::Font score_font; - sf::Text timer_text; - sf::Text score_text; - enum class GameState { RUNNING, GAMEOVER }; - GameState state; - sf::SoundBuffer hit_buffer; - sf::Sound hit_sound; - - public: - void initialize(); - void startGame(); -}; diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/gameplay_video.gif b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/gameplay_video.gif deleted file mode 100644 index 3951615a..00000000 Binary files a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/gameplay_video.gif and /dev/null differ diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/main.cpp b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/main.cpp deleted file mode 100644 index 5000fadf..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "game_manager.h" - -int main() { - GameManager game_manager; - game_manager.initialize(); - game_manager.startGame(); - - return 0; -} diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/mini_hw_2.vcxproj b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/mini_hw_2.vcxproj deleted file mode 100644 index 2af145f2..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/mini_hw_2.vcxproj +++ /dev/null @@ -1,162 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {2113995e-29bf-4536-b568-f9b335d97643} - minihw2 - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(ProjectDir)/SFML/include;%(AdditionalIncludeDirectories) - - - Console - true - $(ProjectDir)/SFML/lib - sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-audio-d.lib;%(AdditionalDependencies) - - - xcopy /Y "$(ProjectDir)SFML\bin\*.dll" "$(OutDir)" - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(ProjectDir)/SFML/include;%(AdditionalIncludeDirectories) - - - Console - true - $(ProjectDir)/SFML/lib - sfml-graphics.lib;sfml-window.lib;sfml-system.lib;sfml-audio.lib; - - - xcopy /Y "$(ProjectDir)SFML\bin\*.dll" "$(OutDir)" - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(ProjectDir)/SFML/include;%(AdditionalIncludeDirectories) - - - Console - true - $(ProjectDir)/SFML/lib - sfml-graphics-d.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-audio-d.lib;%(AdditionalDependencies) - - - xcopy /Y "$(ProjectDir)SFML\bin\*.dll" "$(OutDir)" - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(ProjectDir)/SFML/include;%(AdditionalIncludeDirectories) - - - Console - true - $(ProjectDir)/SFML/lib - sfml-graphics.lib;sfml-window.lib;sfml-system.lib;sfml-audio.lib; - - - xcopy /Y "$(ProjectDir)SFML\bin\*.dll" "$(OutDir)" - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/mini_hw_2.vcxproj.filters b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/mini_hw_2.vcxproj.filters deleted file mode 100644 index f8a8c70c..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/mini_hw_2.vcxproj.filters +++ /dev/null @@ -1,39 +0,0 @@ - - - - - {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/sem2/SuvorovIA/mini_hw_2/mini_hw_2/utils.cpp b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/utils.cpp deleted file mode 100644 index cb561191..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/utils.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "utils.h" - -float Utility::getRandomFloat(int min, int max) { - std::random_device rd; - std::mt19937 gen(rd()); - std::uniform_real_distribution<> dis(min, max); - return dis(gen); -} -sf::Vector2f Utility::newCirclePosition() { - float X = Utility::getRandomFloat(100, Constants::SCREEN_WIDTH - 100); - float Y = Utility::getRandomFloat(100, Constants::SCREEN_HEIGHT - 100); - return sf::Vector2f(X, Y); -} diff --git a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/utils.h b/sem2/SuvorovIA/mini_hw_2/mini_hw_2/utils.h deleted file mode 100644 index 674e0f7c..00000000 --- a/sem2/SuvorovIA/mini_hw_2/mini_hw_2/utils.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include -#include -#include "constants.h" - -class Utility { - public: - static float getRandomFloat(int min, int max); - static sf::Vector2f newCirclePosition(); -}; diff --git a/sem2/SuvorovIA/mini_hw_3/mini_hw_3/input.txt b/sem2/SuvorovIA/mini_hw_3/mini_hw_3/input.txt new file mode 100644 index 00000000..3f95ed8e --- /dev/null +++ b/sem2/SuvorovIA/mini_hw_3/mini_hw_3/input.txt @@ -0,0 +1,6 @@ +Hello world +C++ programming is fun +Lambda expressions +STL algorithms +Short +A very long string just for testing purposes \ No newline at end of file diff --git a/sem2/SuvorovIA/mini_hw_3/mini_hw_3/mini_hw_3.cpp b/sem2/SuvorovIA/mini_hw_3/mini_hw_3/mini_hw_3.cpp new file mode 100644 index 00000000..a5344bef --- /dev/null +++ b/sem2/SuvorovIA/mini_hw_3/mini_hw_3/mini_hw_3.cpp @@ -0,0 +1,85 @@ +#include +#include +#include +#include +#include + +void solve() { + std::ifstream file_input("input.txt"); + std::string line; + std::vector lines; + + while (std::getline(file_input, line)) { + lines.push_back(line); + } + file_input.close(); + + std::vector original_lines = lines; + + int length; + std::cin >> length; + std::string word; + std::cin >> word; + + auto is_shorter_length = [length](const std::string& str) { + return str.length() < length; + }; + + lines.erase(std::remove_if(lines.begin(), lines.end(), is_shorter_length), + lines.end()); + std::vector after_removal = lines; + + auto is_vowel = [](char ch) { + char lower_letter = std::tolower(ch); + return lower_letter == 'a' || lower_letter == 'e' || lower_letter == 'i' || + lower_letter == 'o' || lower_letter == 'u' || lower_letter == 'y'; + }; + + std::vector without_vowels = lines; + + for (auto& str : without_vowels) { + str.erase(std::remove_if(str.begin(), str.end(), is_vowel), str.end()); + } + + auto contains_word = [&](const std::string& str) { + return str.find(word) != std::string::npos; + }; + + auto it = + std::find_if(original_lines.begin(), original_lines.end(), contains_word); + std::string search_result; + if (it != original_lines.end()) { + search_result = "Слово " + word + " найдено в строке: " + *it; + } else { + search_result = "Слово " + word + " не найдено ни в одной строке"; + } + + int letters_count = 0; + for (const auto& str : without_vowels) { + letters_count += str.length(); + } + + std::vector lengths; + for (const auto& str : after_removal) { + lengths.push_back(str.length()); + } + + std::ofstream file_output("output.txt"); + for (std::string& row : original_lines) file_output << row << std::endl; + file_output << "" << std::endl; + for (std::string& row : after_removal) file_output << row << std::endl; + file_output << "" << std::endl; + for (std::string& row : without_vowels) file_output << row << std::endl; + file_output << "" << std::endl; + file_output << search_result << std::endl; + file_output << "" << std::endl; + file_output << letters_count << std::endl; + file_output << "" << std::endl; + for (int& len : lengths) file_output << std::to_string(len) + "\n"; +} + +int main() { + solve(); + + return 0; +} diff --git a/sem2/SuvorovIA/mini_hw_3/mini_hw_3/output.txt b/sem2/SuvorovIA/mini_hw_3/mini_hw_3/output.txt new file mode 100644 index 00000000..99a2b091 --- /dev/null +++ b/sem2/SuvorovIA/mini_hw_3/mini_hw_3/output.txt @@ -0,0 +1,31 @@ +Hello world +C++ programming is fun +Lambda expressions +STL algorithms +Short +A very long string just for testing purposes + +Hello world +C++ programming is fun +Lambda expressions +STL algorithms +Short +A very long string just for testing purposes + +Hll wrld +C++ prgrmmng s fn +Lmbd xprssns +STL lgrthms +Shrt + vr lng strng jst fr tstng prpss + + hello + +84 + +11 +22 +18 +14 +5 +44 diff --git a/sem2/SuvorovIA/mini_hw_4/mini_hw_4/mini_hw_4.cpp b/sem2/SuvorovIA/mini_hw_4/mini_hw_4/mini_hw_4.cpp new file mode 100644 index 00000000..7940ea0c --- /dev/null +++ b/sem2/SuvorovIA/mini_hw_4/mini_hw_4/mini_hw_4.cpp @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include + +void solve() { + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_int_distribution<> dist(-50, 100); + std::vector v(20); + std::generate(v.begin(), v.end(), [&]() {return dist(gen); }); + + int _min = *std::min_element(v.begin(), v.end()); + int _max = *std::max_element(v.begin(), v.end()); + + std::vector sorted_v = v; + std::sort(sorted_v.begin(), sorted_v.end()); + + int zero_count = std::count(v.begin(), v.end(), 0); + int positive_count = std::count_if(v.begin(), v.end(), [](int x) { return x > 0; }); + int negative_count = std::count_if(v.begin(), v.end(), [](int x) {return x < 0;}); + + float average = std::accumulate(v.begin(), v.end(), 0.0) / v.size(); + + std::vector less_average_v = v; + less_average_v.erase(std::remove_if(less_average_v.begin(), less_average_v.end(), [average](int x) { return x >= average; }), less_average_v.end()); + + std::vector unique_v = v; + std::sort(unique_v.begin(), unique_v.end()); + auto last = std::unique(unique_v.begin(), unique_v.end()); + unique_v.erase(last, unique_v.end()); + + std::ofstream file_output("output.txt"); + file_output << "Original vector: "; + std::copy(v.begin(), v.end(), + std::ostream_iterator(file_output, " ")); + file_output << "\nMinimum: " << _min << "\nMaximum: " << _max << std::endl; + file_output << "Sorted vector: "; + std::copy(sorted_v.begin(), sorted_v.end(), + std::ostream_iterator(file_output, " ")); + file_output << "\nZero count: " << zero_count << "\nPositive count: " << positive_count << "\nNegative count: " << negative_count << std::endl; + file_output << "Average: " << average << std::endl; + file_output << "Elements less than average: "; + std::copy(less_average_v.begin(), less_average_v.end(), + std::ostream_iterator(file_output, " ")); + file_output << "\nUnique elements: "; + std::copy(unique_v.begin(), unique_v.end(), + std::ostream_iterator(file_output, " ")); +} + +int main() { + solve(); + + return 0; +} diff --git a/sem2/SuvorovIA/mini_hw_4/mini_hw_4/output.txt b/sem2/SuvorovIA/mini_hw_4/mini_hw_4/output.txt new file mode 100644 index 00000000..a81b6c82 --- /dev/null +++ b/sem2/SuvorovIA/mini_hw_4/mini_hw_4/output.txt @@ -0,0 +1,10 @@ +Original vector: 40 45 -38 60 83 -30 -12 66 1 37 -10 46 22 25 65 84 -28 0 16 42 +Minimum: -38 +Maximum: 84 +Sorted vector: -38 -30 -28 -12 -10 0 1 16 22 25 37 40 42 45 46 60 65 66 83 84 +Zero count: 1 +Positive count: 14 +Negative count: 5 +Average: 25.7 +Elements less than average: -38 -30 -12 1 -10 22 25 -28 0 16 +Unique elements: -38 -30 -28 -12 -10 0 1 16 22 25 37 40 42 45 46 60 65 66 83 84 \ No newline at end of file