From bb48a46e72075a2c768fea1adcf93ae1b442f11e Mon Sep 17 00:00:00 2001 From: MikePuzanov Date: Fri, 26 Feb 2021 22:42:42 +0300 Subject: [PATCH 1/2] hw1Sort --- hw1Sort/hw1Sort.sln | 25 +++++++++++++ hw1Sort/hw1Sort/Program.cs | 65 ++++++++++++++++++++++++++++++++++ hw1Sort/hw1Sort/hw1Sort.csproj | 8 +++++ 3 files changed, 98 insertions(+) create mode 100644 hw1Sort/hw1Sort.sln create mode 100644 hw1Sort/hw1Sort/Program.cs create mode 100644 hw1Sort/hw1Sort/hw1Sort.csproj diff --git a/hw1Sort/hw1Sort.sln b/hw1Sort/hw1Sort.sln new file mode 100644 index 0000000..37acaeb --- /dev/null +++ b/hw1Sort/hw1Sort.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31005.135 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "hw1Sort", "hw1Sort\hw1Sort.csproj", "{B0687189-596B-44A1-BEDF-E6832C5A3681}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0687189-596B-44A1-BEDF-E6832C5A3681}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0687189-596B-44A1-BEDF-E6832C5A3681}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0687189-596B-44A1-BEDF-E6832C5A3681}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0687189-596B-44A1-BEDF-E6832C5A3681}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {041E2F7B-8765-486E-AD50-75F5DE00B0A1} + EndGlobalSection +EndGlobal diff --git a/hw1Sort/hw1Sort/Program.cs b/hw1Sort/hw1Sort/Program.cs new file mode 100644 index 0000000..0bfb286 --- /dev/null +++ b/hw1Sort/hw1Sort/Program.cs @@ -0,0 +1,65 @@ +using System; + +namespace hw1Sort +{ + class Program + { + static void Sort(int[] array) + { + for (int i = 0; i < array.Length - 1; i++) + { + for (int j = i + 1; j < array.Length; j++) + { + if (array[i] > array[j]) + { + int numberSwap; + numberSwap = array[i]; + array[i] = array[j]; + array[j] = numberSwap; + } + } + } + } + + static bool Test() + { + int[] array = { 9, 3, 2, 5, 7, 8 }; + Sort(array); + for (int i = 0; i < array.Length - 1; i++) + { + if (array[i] > array[i + 1]) + { + return false; + } + } + return true; + } + + static void Main(string[] args) + { + if (!Test()) + { + Console.WriteLine("Тест не пройден!"); + return; + } + Console.WriteLine("Тест пройден!"); + Console.WriteLine("Введите числа для сортировки: "); + string str = Console.ReadLine(); + string[] numbers = str.Split(' '); + int[] array = new int[numbers.Length]; + int count = 0; + foreach (var s in numbers) + { + array[count] = int.Parse(s); + count++; + } + Sort(array); + Console.WriteLine("Отсортированный массив: "); + for (int i = 0; i < array.Length; i++) + { + Console.Write(array[i]); + Console.Write(" "); + } + } + } +} \ No newline at end of file diff --git a/hw1Sort/hw1Sort/hw1Sort.csproj b/hw1Sort/hw1Sort/hw1Sort.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/hw1Sort/hw1Sort/hw1Sort.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + From b4bc2ddf9c40e5aa40431a232308abc74a350f3f Mon Sep 17 00:00:00 2001 From: MikePuzanov Date: Wed, 7 Apr 2021 18:15:20 +0300 Subject: [PATCH 2/2] appveyor.yml --- appveyor.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..e7e7cb3 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,6 @@ +image: Visual Studio 2019 + +build_script: + - For /R %%I in (*.sln) do dotnet test %%I + +test: off \ No newline at end of file