【发布时间】:2020-03-23 00:31:33
【问题描述】:
我用维数组和两个循环制作了矩阵对角线 我有两个 crosa 一个,通过将颜色线从右到左按钮更改我该怎么做?
这是我的代码,我制作了从左到右按钮的交叉线 现在我想要从右到左的按钮 这是我的代码
static void DisplayMatrixWithCross(int[,] matrix)
{
for (int row = 0; row < 7; row++)
{
for (int column = 0; column < 7; column++)
{
if (row == column)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.Write(matrix[row, column] + " ");
}
else if ()
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write(matrix[row, column] + " ");
}
else {
Console.ForegroundColor = ConsoleColor.White;
Console.Write(matrix[row, column] + " ");
}
}
Console.WriteLine();
}
}
我添加了一张照片希望你能看到!
【问题讨论】:
标签: c#