From 705c0faed1037276b3f7223e257c166426aaa13b Mon Sep 17 00:00:00 2001 From: Osyagina_Anna Date: Thu, 2 May 2024 10:15:04 +0400 Subject: [PATCH] LabWork05 --- ConsoleApp1/ConsoleApp1.sln | 31 ----- ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj | 10 -- ConsoleApp1/ConsoleApp1/Program.cs | 68 ---------- ConsoleApp1/ConsoleApp2/ConsoleApp2.csproj | 10 -- ConsoleApp1/ConsoleApp2/Program.cs | 113 ----------------- WinFormsApp1/WinFormsApp1.sln | 25 ---- WinFormsApp1/WinFormsApp1/Form1.Designer.cs | 39 ------ WinFormsApp1/WinFormsApp1/Form1.cs | 10 -- WinFormsApp1/WinFormsApp1/Form1.resx | 120 ------------------ WinFormsApp1/WinFormsApp1/Program.cs | 17 --- WinFormsApp1/WinFormsApp1/WinFormsApp1.csproj | 11 -- 11 files changed, 454 deletions(-) delete mode 100644 ConsoleApp1/ConsoleApp1.sln delete mode 100644 ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj delete mode 100644 ConsoleApp1/ConsoleApp1/Program.cs delete mode 100644 ConsoleApp1/ConsoleApp2/ConsoleApp2.csproj delete mode 100644 ConsoleApp1/ConsoleApp2/Program.cs delete mode 100644 WinFormsApp1/WinFormsApp1.sln delete mode 100644 WinFormsApp1/WinFormsApp1/Form1.Designer.cs delete mode 100644 WinFormsApp1/WinFormsApp1/Form1.cs delete mode 100644 WinFormsApp1/WinFormsApp1/Form1.resx delete mode 100644 WinFormsApp1/WinFormsApp1/Program.cs delete mode 100644 WinFormsApp1/WinFormsApp1/WinFormsApp1.csproj diff --git a/ConsoleApp1/ConsoleApp1.sln b/ConsoleApp1/ConsoleApp1.sln deleted file mode 100644 index 2ba4487..0000000 --- a/ConsoleApp1/ConsoleApp1.sln +++ /dev/null @@ -1,31 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34525.116 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{D8A4ACE0-0728-47AB-9F80-9EDA475782ED}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp2", "ConsoleApp2\ConsoleApp2.csproj", "{C1FC7C16-B9EC-4007-BD39-E6B47A89CE34}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D8A4ACE0-0728-47AB-9F80-9EDA475782ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D8A4ACE0-0728-47AB-9F80-9EDA475782ED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D8A4ACE0-0728-47AB-9F80-9EDA475782ED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D8A4ACE0-0728-47AB-9F80-9EDA475782ED}.Release|Any CPU.Build.0 = Release|Any CPU - {C1FC7C16-B9EC-4007-BD39-E6B47A89CE34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C1FC7C16-B9EC-4007-BD39-E6B47A89CE34}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C1FC7C16-B9EC-4007-BD39-E6B47A89CE34}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C1FC7C16-B9EC-4007-BD39-E6B47A89CE34}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3368BA78-2800-49EC-9A71-865DC3C2F15F} - EndGlobalSection -EndGlobal diff --git a/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj deleted file mode 100644 index 2150e37..0000000 --- a/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - Exe - net8.0 - enable - enable - - - diff --git a/ConsoleApp1/ConsoleApp1/Program.cs b/ConsoleApp1/ConsoleApp1/Program.cs deleted file mode 100644 index 16bb850..0000000 --- a/ConsoleApp1/ConsoleApp1/Program.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System.Collections; -using System; - -// Класс компонента компьютера -public class ComputerComponent -{ - public string Name { get; set; } - public string Type { get; set; } - - public ComputerComponent(string name, string type) - { - Name = name; - Type = type; - } -} - -// АТД Очередь на основе массива -public class CustomQueue -{ - private ArrayList elements = new ArrayList(); - - public int Count { get { return elements.Count; } } - - public void Enqueue(ComputerComponent component) - { - elements.Add(component); - } - - public ComputerComponent Dequeue() - { - if (elements.Count == 0) - { - throw new InvalidOperationException("Queue is empty"); - } - - ComputerComponent component = (ComputerComponent)elements[0]; - elements.RemoveAt(0); - return component; - } - - public ComputerComponent Peek() - { - if (elements.Count == 0) - { - throw new InvalidOperationException("Queue is empty"); - } - - return (ComputerComponent)elements[0]; - } -} -class Program -{ - public static void Main(string[] args) - { - CustomQueue queue = new CustomQueue(); - - // Добавление компонентов в очередь - ComputerComponent cpu = new ComputerComponent("Intel Core i7", "CPU"); - ComputerComponent gpu = new ComputerComponent("Nvidia RTX 3080", "GPU"); - - queue.Enqueue(cpu); - queue.Enqueue(gpu); - - // Проверка совместимости компонентов в сборке - Console.WriteLine("Первый компонент в очереди: {0} ({1})", queue.Peek().Name, queue.Peek().Type); - Console.WriteLine("Извлечен компонент из очереди: {0} ({1})", queue.Dequeue().Name, queue.Dequeue().Type); - } -} diff --git a/ConsoleApp1/ConsoleApp2/ConsoleApp2.csproj b/ConsoleApp1/ConsoleApp2/ConsoleApp2.csproj deleted file mode 100644 index 2150e37..0000000 --- a/ConsoleApp1/ConsoleApp2/ConsoleApp2.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - Exe - net8.0 - enable - enable - - - diff --git a/ConsoleApp1/ConsoleApp2/Program.cs b/ConsoleApp1/ConsoleApp2/Program.cs deleted file mode 100644 index ae6071b..0000000 --- a/ConsoleApp1/ConsoleApp2/Program.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; - -// Реализация АТД Очередь -public class Queue -{ - private T[] elements; - private int front, rear, size, capacity; - - public Queue(int capacity) - { - this.capacity = capacity; - elements = new T[capacity]; - front = size = 0; - rear = capacity - 1; - } - - public void Enqueue(T item) - { - if (size == capacity) - throw new Exception("Queue is full"); - rear = (rear + 1) % capacity; - elements[rear] = item; - size++; - } - - public T Dequeue() - { - if (size == 0) - throw new Exception("Queue is empty"); - T item = elements[front]; - front = (front + 1) % capacity; - size--; - return item; - } - - // Реализация СД Массив - public static void SelectionSort(int[] array) - { - for (int i = 0; i < array.Length - 1; i++) - { - int minIndex = i; - for (int j = i + 1; j < array.Length; j++) - { - if (array[j] < array[minIndex]) - { - minIndex = j; - } - } - if (minIndex != i) - { - int temp = array[i]; - array[i] = array[minIndex]; - array[minIndex] = temp; - } - } - } - - // Быстрая сортировка - public static void QuickSort(int[] array, int left, int right) - { - if (left < right) - { - int pivot = Partition(array, left, right); - QuickSort(array, left, pivot - 1); - QuickSort(array, pivot + 1, right); - } - } - - private static int Partition(int[] array, int left, int right) - { - int pivot = array[right]; - int i = left - 1; - for (int j = left; j < right; j++) - { - if (array[j] < pivot) - { - i++; - int temp = array[i]; - array[i] = array[j]; - array[j] = temp; - } - } - int temp1 = array[i + 1]; - array[i + 1] = array[right]; - array[right] = temp1; - return i + 1; - } - - public static void Main() - { - int[] array = { 64, 34, 25, 12, 22, 11, 90 }; - - // Сортировка выбором - Console.WriteLine("Before selection sort:"); - foreach (var item in array) Console.Write(item + " "); - SelectionSort(array); - Console.WriteLine("\n\nAfter selection sort:"); - foreach (var item in array) Console.Write(item + " "); - - // Быстрая сортировка - Console.WriteLine("\n\nBefore quick sort:"); - foreach (var item in array) Console.Write(item + " "); - QuickSort(array, 0, array.Length - 1); - Console.WriteLine("\n\nAfter quick sort:"); - foreach (var item in array) Console.Write(item + " "); - - // Использование Очереди - Queue queue = new Queue(5); - queue.Enqueue(10); - queue.Enqueue(20); - queue.Dequeue(); - } -} \ No newline at end of file diff --git a/WinFormsApp1/WinFormsApp1.sln b/WinFormsApp1/WinFormsApp1.sln deleted file mode 100644 index cc16879..0000000 --- a/WinFormsApp1/WinFormsApp1.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.8.34525.116 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsApp1", "WinFormsApp1\WinFormsApp1.csproj", "{50092433-6AF5-4E71-9559-079AE2F9901A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {50092433-6AF5-4E71-9559-079AE2F9901A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50092433-6AF5-4E71-9559-079AE2F9901A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50092433-6AF5-4E71-9559-079AE2F9901A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50092433-6AF5-4E71-9559-079AE2F9901A}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {59C3FED6-0E53-4AF0-9E1B-5ACF902ED5CE} - EndGlobalSection -EndGlobal diff --git a/WinFormsApp1/WinFormsApp1/Form1.Designer.cs b/WinFormsApp1/WinFormsApp1/Form1.Designer.cs deleted file mode 100644 index 1ac166c..0000000 --- a/WinFormsApp1/WinFormsApp1/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace WinFormsApp1 -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} diff --git a/WinFormsApp1/WinFormsApp1/Form1.cs b/WinFormsApp1/WinFormsApp1/Form1.cs deleted file mode 100644 index dabe0d0..0000000 --- a/WinFormsApp1/WinFormsApp1/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace WinFormsApp1 -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/WinFormsApp1/WinFormsApp1/Form1.resx b/WinFormsApp1/WinFormsApp1/Form1.resx deleted file mode 100644 index 1af7de1..0000000 --- a/WinFormsApp1/WinFormsApp1/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/WinFormsApp1/WinFormsApp1/Program.cs b/WinFormsApp1/WinFormsApp1/Program.cs deleted file mode 100644 index 1e39c2a..0000000 --- a/WinFormsApp1/WinFormsApp1/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace WinFormsApp1 -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); - } - } -} \ No newline at end of file diff --git a/WinFormsApp1/WinFormsApp1/WinFormsApp1.csproj b/WinFormsApp1/WinFormsApp1/WinFormsApp1.csproj deleted file mode 100644 index 663fdb8..0000000 --- a/WinFormsApp1/WinFormsApp1/WinFormsApp1.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - WinExe - net8.0-windows - enable - true - enable - - - \ No newline at end of file