.net代码

来源:百度知道 编辑:UC知道 时间:2024/09/22 01:25:35
1 2 3 4 5

16 17 18 19 6

15 24 25 20 7

14 23 22 21 8

13 12 11 10 9

这个图形怎么做!

class s
{
enum Direction { East = 0, South, West, North };
static void Main()
{

const int length = 10;

int startInt = 1;
Direction direct = Direction.East;
int x = 0, y = -1;
int count = 1;
int lengthValue = length;
int value = startInt - 1;

int[,] arr = new int[length, length];

while (lengthValue > 0)
{
draw(direct, lengthValue, ref x, ref y, ref value, ref arr);
ChangeDirection(ref direct);
count--;
if (count > 0)
{
count--;
}
else
{
lengthValue--;
count = 2;
}
}

for (int i = 0; i < length; i++)
{
for (int j = 0; j < leng