标签:blog ar sp for div on log bs ad
方法实例:将一个字符串数组输出为|分割的形式,比如“梅西|卡卡|郑大世”
static void Main(string[] args)
        {
            string[] strArray = {"梅西","卡卡","C罗" };
            Oper(strArray);
            Console.ReadKey();
        }
        static void Oper(string[] strs)
        {
            string resoult = string.Empty;
            for (int i = 0; i < strs.Length-1; i++)
            {
                resoult += strs[i] + "|";
            }
            resoult += strs[strs.Length - 1];
            Console.WriteLine(resoult);
        }
 static void Main(string[] args)
        {
            Say();
            Console.ReadKey();
        }
        static void Say()
        {
            while (true)
            {
                Console.WriteLine("请输入一个1-100之间的数字");
               int  num = Convert.ToInt32(Console.ReadLine());
               if (num < 1 || num > 100)
               {
                   Console.WriteLine("输入超出范围!请重新输入");
                   continue;
               }
            }
        }
标签:blog ar sp for div on log bs ad
原文地址:http://www.cnblogs.com/songfang/p/4093340.html