这是我第一次寻求编程帮助。无论如何,我需要编写一个程序来找到矩阵的行列式(行列式代码将在以后编写)。问题是我无法让我的矩阵显示。看来我的数组写入正确,但输出会跳过 for 循环来写入矩阵。是否需要进行任何更改,或者是否需要以某种方式设置我的数组以确定行列式?
public class DetProg {
public static void main(String[] args) {
Scanner a = new Scanner (System.in);
Random mNum = new Random();
System.out.print("Enter matrix size: ");
int num = a.nextInt();
int numX = num;
int numY = num;
int [][] matNN = new int [numX] [numY];
int det = 0;// 0 is the placeholder until det method is inputted.
int n = mNum.nextInt(100)+1;
if (num >= 2)
{
for(int x = 0; x >= numX; x++)
{
for(int y = 0; y >= numY; y++)
{
matNN [x][y] = n;
System.out.println(matNN[x][y] + " ");
}
}
System.out.println("\n");
System.out.println("Determinant of a matrix is " + det);
}
else
System.out.println("Incorrect matrix size. Exiting...");
}
}