【ChengKing(ZhengJian)】

【ChengKing(ZhengJian)】

博客园 首页 联系 订阅 管理

using System;

namespace Array操作
{
 /// <summary>
 /// Class1 的摘要说明。
 /// </summary>
 class Class1
 {
  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main(string[] args)
  {
   //
   // TODO: 在此处添加代码以启动应用程序
   //
   String[] friends=new String[]{"2mojian","1zhengjian","3xugang","4guoyonghui"};
   Console.WriteLine("操作前数组数据为:");
   foreach(string index in friends)
   {
    Console.Write(index+" ");
   }
   Array.Sort(friends);
   Console.WriteLine("\n排序后的数据为:");
   for(int i=friends.GetLowerBound(0);i<=friends.GetUpperBound(0);i++)
   {
    Console.Write(friends[i]+" ");
   }
   Array.Reverse(friends);
   Console.WriteLine("\n逆序后的数据为:");
   for(int i=friends.GetLowerBound(0);i<=friends.GetUpperBound(0);i++)
   {
    Console.Write(friends[i]+" ");
   }
   Console.WriteLine();
   Console.Read();
  }
 }
}

posted on 2005-11-15 23:47  【ZhengJian】  阅读(547)  评论(0)    收藏  举报