• 大小: 14KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-17
  • 语言: 其他
  • 标签: 程序  绝对原创  

资源简介

冒泡排序法 程序 绝对原创 老师布置的作业,绝对原创,欢迎大家下载

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
    //冒泡排序法
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[5];
            int i j;
            int temp;

            Console.WriteLine(“请输入5个数据:“);
            for (i = 0; i < 5; i++)
            {
                Console.WriteLine(“请输入第{0}个数据:“ i + 1);
                a[i] = int.Parse(Console.ReadLine());
            }


            for (i = 0; i < a.Length - 1; i++)
            {

                for (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(“排序后的数据为:“);
            for (i = 0; i < a.Length; i++)
            {
                Console.Write(“{0}“ a[i]+“   “);
            }
            Console.ReadLine();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      16384  2010-12-20 16:54  ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe

     文件      13824  2010-12-20 16:54  ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.pdb

     文件       5632  2005-12-08 14:51  ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe

     文件       1972  2010-12-20 14:51  ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.csproj

     文件        182  2010-12-28 14:35  ConsoleApplication1\ConsoleApplication1\obj\ConsoleApplication1.csproj.FileList.txt

     文件      16384  2010-12-20 16:54  ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.exe

     文件      13824  2010-12-20 16:54  ConsoleApplication1\ConsoleApplication1\obj\Debug\ConsoleApplication1.pdb

     文件       1176  2010-12-20 16:54  ConsoleApplication1\ConsoleApplication1\Program.cs

     文件       1209  2010-12-20 14:51  ConsoleApplication1\ConsoleApplication1\Properties\AssemblyInfo.cs

     文件        946  2010-12-20 14:51  ConsoleApplication1\ConsoleApplication1.sln

    ..A..H.     10240  2010-12-28 14:35  ConsoleApplication1\ConsoleApplication1.suo

     目录          0  2010-12-20 14:55  ConsoleApplication1\ConsoleApplication1\obj\Debug\Refactor

     目录          0  2010-12-20 14:51  ConsoleApplication1\ConsoleApplication1\obj\Debug\TempPE

     目录          0  2010-12-20 14:53  ConsoleApplication1\ConsoleApplication1\bin\Debug

     目录          0  2010-12-20 16:18  ConsoleApplication1\ConsoleApplication1\obj\Debug

     目录          0  2010-12-20 14:51  ConsoleApplication1\ConsoleApplication1\bin

     目录          0  2010-12-20 14:53  ConsoleApplication1\ConsoleApplication1\obj

     目录          0  2010-12-20 14:51  ConsoleApplication1\ConsoleApplication1\Properties

     目录          0  2010-12-20 16:54  ConsoleApplication1\ConsoleApplication1

     目录          0  2010-12-20 14:51  ConsoleApplication1

----------- ---------  ---------- -----  ----

                81773                    20


评论

共有 条评论