1:冒泡排序,沉底
2:冒泡排序,上浮
3:选择排序,升序
4:选择排序,降序
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
int[] n = { 15, 25, 36, 31, 12, 41, 89, 78, 55, 62 };
int i = 0, j = 0, t = 0, k = 1, m = 0;
Console.Write("选择一个你想要的排序方式(1:冒泡排序,沉底;2:冒泡排序,上浮;3:选择排序,升序;4:选择排序,降序):");
int c;
c = int.Parse(Console.ReadLine());
//冒泡排序,从前往后,下沉
if (c == 1)
{
for (; i < n.Length - 1; i++)
{
for (j = i + 1; j < n.Length; j++)
{
if (n[i] > n[j])
{
t = n[i];
n[i] = n[j