📄 subject_21094.htm
字号:
<p>
序号:21094 发表者:surer 发表日期:2002-11-13 16:58:58
<br>主题:傻了
<br>内容:居然一时间这个算法搞不定了,怎样显示蛇行方阵?<BR> 1 2 3 4 5 6 7<BR>22 23 24 25 26 27 8<BR>21 36 37 38 39 28 9<BR>20 35 42 41 40 29 10<BR>19 34 33 32 31 30 11<BR>18 17 16 15 14 13 12<BR>给点提示
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:累了倦了 回复日期:2002-11-13 18:00:13
<br>内容:前一阵我做过一个这样的东西了<BR>忘了是那个贴子了:(
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:累了倦了 回复日期:2002-11-13 18:01:43
<br>内容:环绕的方向不一样,你自己改吧<BR><BR>// tmp.cpp : Defines the entry point for the console application.<BR>//<BR>#include "stdafx.h"<BR>#include "iostream.h"<BR>#include "string.h"<BR>#include "stdio.h"<BR><BR>void Xyz(unsigned char *str, int len)<BR>{<BR> unsigned char fangxiang = 0;<BR> int i = 0,j = 0,num,cycle = len;<BR> for (num=1;num<=len*len;num++)<BR> {<BR> *(str+i*len+j) = num;<BR> switch(fangxiang)<BR> {<BR> case 0:<BR> if (i == cycle-1)<BR> {<BR> j++;<BR> fangxiang = 1;<BR> }<BR> else i++;<BR> break;<BR> case 1:<BR> if (j==cycle-1)<BR> {<BR> i--;<BR> fangxiang = 2;<BR> }<BR> else j++;<BR> break;<BR> case 2:<BR> if (i==len-cycle)<BR> {<BR> j--;<BR> fangxiang = 3;<BR> }<BR> else i--;<BR> break;<BR> case 3:<BR> if (j==len-cycle+1)<BR> {<BR> i++;<BR> fangxiang = 0;<BR> cycle--;<BR> }<BR> else j--;<BR> }<BR><BR><BR> }<BR>}<BR>int main()<BR>{<BR> unsigned char x[10][10];<BR> Xyz(x[0],8);<BR> return 0;<BR><BR>}<BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -