这是我这一块的代码
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//声明全局变量
int r = 2;//连乘矩阵的个数
int[,] m;//矩阵连乘的表示形式
int[,] s;//截断点
int[] p;//定义p
int n;//p的个数
int[,] h1, a1, b1, c1, d1, e1, f1, g1;
public void Form1_Load(object sender, EventArgs e)
{
m = new int[9, 9];
s = new int[9, 9];
p = new int[9];
n = 8;
p[0] = 2;
p[1] = 65;
p[2] = 34;
p[3] = 7;
p[4] = 17;
p[5] = 9;
p[6] = 57;
p[7] = 14;
p[8] = 4;
for (int i = 1; i <= 9; i++)
{
m[i, i] = 0;//一个矩阵的连乘次数为0
}
InitializeComponent();//初始化
}
m[i, i] = 0;//一个矩阵的连乘次数为0
这句话说的索引超出数组界限,谁能帮我解答一下,怎么改
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//声明全局变量
int r = 2;//连乘矩阵的个数
int[,] m;//矩阵连乘的表示形式
int[,] s;//截断点
int[] p;//定义p
int n;//p的个数
int[,] h1, a1, b1, c1, d1, e1, f1, g1;
public void Form1_Load(object sender, EventArgs e)
{
m = new int[9, 9];
s = new int[9, 9];
p = new int[9];
n = 8;
p[0] = 2;
p[1] = 65;
p[2] = 34;
p[3] = 7;
p[4] = 17;
p[5] = 9;
p[6] = 57;
p[7] = 14;
p[8] = 4;
for (int i = 1; i <= 9; i++)
{
m[i, i] = 0;//一个矩阵的连乘次数为0
}
InitializeComponent();//初始化
}
m[i, i] = 0;//一个矩阵的连乘次数为0
这句话说的索引超出数组界限,谁能帮我解答一下,怎么改


