创建如下所示的数组,并使用for,next循环填充序列值. [英] Create array as given below, and fill the series value with for , next loop.

查看:78
本文介绍了创建如下所示的数组,并使用for,next循环填充序列值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建如下所示的数组,并使用for,下一个循环填充系列值.

Create array as given below, and fill the series value with for , next loop.

1   2   3   4   5
1   4   9   16  25
1   3   5   7   9
9   7   5   3   1



任何人都可以帮助我..



any one will help me..

推荐答案

您可以使用多维数组.

经历这个

http://msdn.microsoft.com/en-us/library/2yd9wwz4 (v = vs.71).aspx [
You can using the multidimensional array.

Go through this one

http://msdn.microsoft.com/en-us/library/2yd9wwz4(v=vs.71).aspx[^]


您不能使用for循环来填充系列-并非没有某种外部数据源.仅通过for循环而没有外部数据源来执行此操作将非常非常笨拙,因为您将需要加载此行是否为第一行?"和如果是,是第2列?" 如果是,则使用值2" satatememts.
做到这一点很简单:
You can''t use a for loop to fill the series - not without an external data source of some kind. To do it with just a for loop and no external data source would be very, very clumsy, as you would need loads of "is this row one?" and "if so, is this column 2?" "If so, use the value 2" satatememts.
Do it the easy way:
int[][] data = new int[][] {new int[] { 1, 2,  3,   4,   5},
                            new int[] { 1,   4,   9,   16 , 25},
                            new int[] { 1,   3,   5 ,  7 ,  9},
                            new int[] { 9,   7,   5  , 3,   1}};


这篇关于创建如下所示的数组,并使用for,next循环填充序列值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆