我在百度上找的数组练习,怎么和网上的结果不一样呢?

来源:百度知道 编辑:UC知道 时间:2024/06/15 14:34:11
数组编程练习题1——检验并打印魔方矩阵
http://zhidao.baidu.com/question/27044296.html?fr=qrl3他的结果说这是魔方?是我写得不对?
还是那位老兄只写完没运行?我的代码如下:
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace MagicMatrix
{
class Program
{

static void Main(string[] args)
{
Bud b = new Bud();
if (b.IsMagicMatrix())
b.Print();
}
}
class Bud
{
public int[,] MaMa = new int[6, 6];
public Bud()
{
MaMa[1, 1] = 17; MaMa[1, 2] = 24; MaMa[1, 3] = 1; MaMa[1, 4] = 8; MaMa[1, 5] = 15;
MaMa[2, 1] = 23; MaMa[2, 2] = 5; MaMa[2, 3] = 7; MaMa[2, 4] = 14; MaMa[2, 5] = 16;
MaMa[3, 1] = 4; M

//我新添了注释,你可以试着运行下.
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace MagicMatrix
{
class Program
{

static void Main(string[] args)
{
Bud b = new Bud();
if (b.IsMagicMatrix())
b.Print();
Console.ReadLine();
}
}
class Bud
{
public int[,] MaMa = new int[6, 6];
public Bud()
{
MaMa[1, 1] = 17; MaMa[1, 2] = 24; MaMa[1, 3] = 1; MaMa[1, 4] = 8; MaMa[1, 5] = 15;
MaMa[2, 1] = 23; MaMa[2, 2] = 5; MaMa[2, 3] = 7; MaMa[2, 4] = 14; MaMa[2, 5] = 16;
MaMa[3, 1] = 4; MaMa[3, 2] = 6; MaMa[3, 3] = 13; MaMa[3, 4] = 20; MaMa[3, 5] = 22;
MaMa[4, 1] = 10; MaMa[4, 2] = 12; MaMa[4, 3] = 19; MaMa[4, 4] = 21