c# 反转,新手看

例一:

using System;
using System.Collections.Generic;
using System.Text;

namespace testa
{
    class Program
    {
        static void Main(string[] args)
        {
         string  a= Console.ReadLine().ToString();
        

           char[] arr = a.ToCharArray();
            Array.Reverse(arr );
            foreach (char i in arr)
            {
                Console.Write(i);
            }
             
            Console .Read ();

        }
    }
}

 

 

例二:

 

using System;
using System.Collections.Generic;
using System.Text;

namespace test1
{
    class Program
    {
        static void Main(string[] args)
        {
            string d = "abcdef";
            char[] g = d.ToCharArray();
            Array.Reverse(g);
            Console.Write(g);
        }
    }
}


posted @ 2008-08-29 11:21  kin2321  阅读(182)  评论(0编辑  收藏  举报