c#数组排序
来源:互联网 发布:富士国际语学院 知乎 编辑:程序博客网 时间:2024/05/16 17:47
c#读入与写出我只知道如下代码这种,所以很多方面都感觉没c++方便,排序函数要自己写,还不知道c#有什么函数可用,有没有排序函数,还有c++的头文件之类的都用不了了,郁闷!!!!!
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace MyFirstAPP{ class Program { static void sort(int[] a,int n) { int i,j; for(i=0;i<n;++i) { for (j = i + 1; j < n;++j ) { if (a[i] > a[j]) { a[i] ^= a[j]; a[j] = a[i] ^ a[j]; a[i] = a[j] ^ a[i]; } } } } static void Main(string[] args) { Console.WriteLine("请输入一个数:"); int n = Convert.ToInt32(Console.ReadLine()); int[] a = new int[n]; Console.WriteLine("请输入{0}个数",n); for (int i = 0; i < n;++i) { a[i] = Convert.ToInt32(Console.ReadLine()); } sort(a,n); for (int i = 0; i < n;++i) { Console.Write("{0} ",a[i]); } Console.WriteLine(); } }}
0 0
- C#数组排序
- c#数组排序
- C#中的数组排序
- C#数组排序
- C#数组排序问题
- c# 数组排序
- C#数组随机排序
- C#数组排序
- C#数组排序
- C# 数组排序
- C# 数组排序
- c#数组排序
- C#数组冒泡排序
- C#关于数组排序
- C#对象数组排序方法
- C#数组查找与排序
- C#对象数组排序方法
- C#数组查找与排序
- 971 爬行的蚂蚁【水题...】
- POJ 1068 Parencodings
- 关于Web Sevice
- FFT中的栅栏效应
- 格雷码实现
- c#数组排序
- 修改PurchQty的方法
- Gzip你值得尝试
- freemarker springmvc整合
- Server Error in '/' Application 服务器错误
- 第三方——科大讯飞语音合成
- 面试简答
- wxpython初学者(三) 之flexgirdsizer,TextEntryDialog,SingleChoiceDialog
- ContentValues、HashTable、HashMap异同