20251101
This commit is contained in:
10
cs4/CS4_3/CS4_3.csproj
Normal file
10
cs4/CS4_3/CS4_3.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs4/CS4_3/CS4_3.sln
Normal file
25
cs4/CS4_3/CS4_3.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CS4_3", "CS4_3.csproj", "{FCCD1D8D-1B13-483D-837B-FBB41A496BCD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FCCD1D8D-1B13-483D-837B-FBB41A496BCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FCCD1D8D-1B13-483D-837B-FBB41A496BCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FCCD1D8D-1B13-483D-837B-FBB41A496BCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FCCD1D8D-1B13-483D-837B-FBB41A496BCD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FCF021EF-C7A9-414B-ACEB-91F4122C1216}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
40
cs4/CS4_3/Program.cs
Normal file
40
cs4/CS4_3/Program.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
namespace CS4_3
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int[] A = new int[10];
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < A.Length; i++)
|
||||
{
|
||||
A[i] = rand.Next(1, 999);
|
||||
}
|
||||
Console.WriteLine("原数组:");
|
||||
for (int i = 0; i < A.Length; i++)
|
||||
{
|
||||
Console.Write(A[i] + " ");
|
||||
}
|
||||
// 冒泡排序
|
||||
int temp;
|
||||
for (int i = 0; i < A.Length - 1; i++)
|
||||
{
|
||||
for (int j = 0; j < A.Length - 1 - i; j++)
|
||||
{
|
||||
if (A[j] > A[j + 1])
|
||||
{
|
||||
temp = A[j];
|
||||
A[j] = A[j + 1];
|
||||
A[j + 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
Console.WriteLine("\n排序后数组:");
|
||||
for (int i = 0; i < A.Length; i++)
|
||||
{
|
||||
Console.Write(A[i] + " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user