Initial commit
This commit is contained in:
36
9.6-BubbleSort/9.6-BubbleSort.csproj
Normal file
36
9.6-BubbleSort/9.6-BubbleSort.csproj
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{3788011D-2FE6-456D-86EF-5506B7F9F0D3}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>BubbleSort</RootNamespace>
|
||||
<AssemblyName>9.6-BubbleSort</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Compile Include="BubbleSort.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
9.6-BubbleSort/9.6-BubbleSort.sln
Normal file
17
9.6-BubbleSort/9.6-BubbleSort.sln
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "9.6-BubbleSort", "9.6-BubbleSort.csproj", "{3788011D-2FE6-456D-86EF-5506B7F9F0D3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3788011D-2FE6-456D-86EF-5506B7F9F0D3}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{3788011D-2FE6-456D-86EF-5506B7F9F0D3}.Debug|x86.Build.0 = Debug|x86
|
||||
{3788011D-2FE6-456D-86EF-5506B7F9F0D3}.Release|x86.ActiveCfg = Release|x86
|
||||
{3788011D-2FE6-456D-86EF-5506B7F9F0D3}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
12
9.6-BubbleSort/9.6-BubbleSort.userprefs
Normal file
12
9.6-BubbleSort/9.6-BubbleSort.userprefs
Normal file
@@ -0,0 +1,12 @@
|
||||
<Properties StartupItem="9.6-BubbleSort.csproj">
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="BubbleSort.cs">
|
||||
<Files>
|
||||
<File FileName="BubbleSort.cs" Line="21" Column="35" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<BreakpointStore />
|
||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
||||
</Properties>
|
||||
43
9.6-BubbleSort/BubbleSort.cs
Normal file
43
9.6-BubbleSort/BubbleSort.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
|
||||
class BubbleSort {
|
||||
const int SIZE = 10, MIN = 0, MAX = 100;
|
||||
|
||||
public static void Main() {
|
||||
Random rand = new Random();
|
||||
short[] myArray = new short[SIZE];
|
||||
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
myArray[i] = (short)rand.Next(MIN, MAX);
|
||||
}
|
||||
|
||||
Console.WriteLine("--------- myArray fore sortering ------------");
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
Console.WriteLine("myArray[{0}]= {1}", i, myArray[i]);
|
||||
}
|
||||
|
||||
myBubbleSort(myArray);
|
||||
|
||||
Console.WriteLine("--------- myArray efter sortering ------------");
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
Console.WriteLine("myArray[{0}]= {1}", i, myArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void myBubbleSort(short[] arr) {
|
||||
short temp = 0;
|
||||
|
||||
for (int walker = 0; walker < arr.Length; walker++) {
|
||||
for (int sorter = 0; sorter < arr.Length - 1; sorter++) {
|
||||
if (arr[sorter] > arr[sorter + 1]) {
|
||||
temp = arr[sorter + 1];
|
||||
arr[sorter + 1] = arr[sorter];
|
||||
arr[sorter] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
9.6-BubbleSort/bin/Debug/9.6-BubbleSort.exe
Normal file
BIN
9.6-BubbleSort/bin/Debug/9.6-BubbleSort.exe
Normal file
Binary file not shown.
BIN
9.6-BubbleSort/bin/Debug/9.6-BubbleSort.pdb
Normal file
BIN
9.6-BubbleSort/bin/Debug/9.6-BubbleSort.pdb
Normal file
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
C:\Users\Crille\CSharp\9.6-BubbleSort\bin\Debug\9.6-BubbleSort.exe
|
||||
C:\Users\Crille\CSharp\9.6-BubbleSort\bin\Debug\9.6-BubbleSort.pdb
|
||||
C:\Users\Crille\CSharp\9.6-BubbleSort\obj\x86\Debug\9.6-BubbleSort.csprojResolveAssemblyReference.cache
|
||||
C:\Users\Crille\CSharp\9.6-BubbleSort\obj\x86\Debug\9.6-BubbleSort.exe
|
||||
C:\Users\Crille\CSharp\9.6-BubbleSort\obj\x86\Debug\9.6-BubbleSort.pdb
|
||||
Binary file not shown.
BIN
9.6-BubbleSort/obj/x86/Debug/9.6-BubbleSort.exe
Normal file
BIN
9.6-BubbleSort/obj/x86/Debug/9.6-BubbleSort.exe
Normal file
Binary file not shown.
BIN
9.6-BubbleSort/obj/x86/Debug/9.6-BubbleSort.pdb
Normal file
BIN
9.6-BubbleSort/obj/x86/Debug/9.6-BubbleSort.pdb
Normal file
Binary file not shown.
Reference in New Issue
Block a user