文件名称:dayin
- 所属分类:
- C#编程
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 10kb
- 下载次数:
- 0次
- 提 供 者:
- 王**
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
编写螺旋方阵。其中螺旋方阵形式如下:
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
设row,column分别代表行、列坐标,变量p从1到n2将p依次存入数组a[row][column]中,要确定row、colomn的变化情况。分析如下:引进变量k,初值为n。当数据存入到左下角或右上角时,k减1,这样可保证输出时方阵。引进变量t,初值为1,当数据存入到右下角时,令t改变符合,当存入到左上角时,t又改变符合,这样可保证赋值到正确的数组坐标。
-Write spiral square. Square spiral form which is as follows: 1 12 1,110,213,169,314,158,456 7 set row, column representing the row, column coordinates, the variable p p from 1 to n2 will turn into an array a [row] [column], we must determine the row, colomn changes. As follows: the introduction of variable k, the initial value is n. When the data stored in the lower left or upper right corner when, k by 1, it will ensure that the output matrix. The introduction of variable t, the initial value is 1, when the data stored in the lower right corner, have resulted in changes consistent with t, the time when the deposit to the upper left corner, t and changing the match, it will ensure that the correct assignment to the array of coordinates.
1 12 11 10
2 13 16 9
3 14 15 8
4 5 6 7
设row,column分别代表行、列坐标,变量p从1到n2将p依次存入数组a[row][column]中,要确定row、colomn的变化情况。分析如下:引进变量k,初值为n。当数据存入到左下角或右上角时,k减1,这样可保证输出时方阵。引进变量t,初值为1,当数据存入到右下角时,令t改变符合,当存入到左上角时,t又改变符合,这样可保证赋值到正确的数组坐标。
-Write spiral square. Square spiral form which is as follows: 1 12 1,110,213,169,314,158,456 7 set row, column representing the row, column coordinates, the variable p p from 1 to n2 will turn into an array a [row] [column], we must determine the row, colomn changes. As follows: the introduction of variable k, the initial value is n. When the data stored in the lower left or upper right corner when, k by 1, it will ensure that the output matrix. The introduction of variable t, the initial value is 1, when the data stored in the lower right corner, have resulted in changes consistent with t, the time when the deposit to the upper left corner, t and changing the match, it will ensure that the correct assignment to the array of coordinates.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
打印旋转方阵\3_19.cpp
............\3_19.dsp
............\3_19.dsw
............\3_19.ncb
............\3_19.opt
............\3_19.plg
............\编写螺旋方阵.doc
打印旋转方阵
............\3_19.dsp
............\3_19.dsw
............\3_19.ncb
............\3_19.opt
............\3_19.plg
............\编写螺旋方阵.doc
打印旋转方阵