定义一个字符串数组,按字符串长度从大到小打印出来
namespace _2017_2_28___比较字符串数组 { class Program { static void Main(string[] args) { String[] a = new string[6] { "qwer", "erfdc", "rtg", "asdfgh", "we" ,"dhsgdjdsj"}; String b; for (int i = 0; i < 6;i++ ) { for (int j = i + 1; j < 6;j++ ) { if(a[i].Length<a[j].Length) { b = a[i]; a[i]=a[j]; a[j] = b; } } Console.WriteLine(a[i]); } Console.ReadLine(); } } }