码迷,mamicode.com
首页 > 编程语言 > 详细

数组杂记

时间:2017-02-15 12:35:05      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:length   logs   ons   ++   字符串   初始化   log   write   class   

int[] nums = { 12,13,14,15,16,17,18}; //初始化字符串
            int length = Convert.ToInt32(nums.Length);//转化
            //Console.WriteLine(length); length=7
            string[] str = new string[length];
            for (int i = 0; i < str.Length; i++)
            {
                str[i] = Convert.ToString(nums[i]);
            }
            //输出新数组
            Console.Write("新数组是:");
            for (int i = 0; i < str.Length; i++)
            {
                Console.Write(" "+str[i]);
            }

                Console.WriteLine();

 

数组杂记

标签:length   logs   ons   ++   字符串   初始化   log   write   class   

原文地址:http://www.cnblogs.com/luluit/p/6400531.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!