为什么";写“;函数不';我第一时间不工作
本文关键字:第一时间 工作 quot 为什么 函数 | 更新日期: 2023-09-27 18:21:45
At result write函数不适用于"8",但它可以写入7,6,5,。。。分别地当我跟踪代码时,我找不到任何错误。。。(代码必须用数字绘制棋盘)
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine(" a b c d e f g h");
Console.BackgroundColor = ConsoleColor.Blue;
Console.Write(" ╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗'n");
Console.ForegroundColor = ConsoleColor.Blue;
for (int i = 7; i > -1;i--)
{
Console.Write((i + 1).ToString());//Problem is here
for (int j=0;j<8;j++)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue;
Console.Write("║");
if(i%2!=0)
{
if(j%2==0)
{
Console.BackgroundColor = ConsoleColor.White;
}
else
{
Console.BackgroundColor = ConsoleColor.Black;
}
}
else
{
if (j % 2 == 0)
{
Console.BackgroundColor = ConsoleColor.Black;
}
else
{
Console.BackgroundColor = ConsoleColor.White;
}
}
Console.Write(" "+ch[i,j].ToString()+" ");
}
Console.BackgroundColor = ConsoleColor.Blue;
Console.Write("║'n");
if(i!=0)
{
Console.WriteLine(" ╠═══╬═══╬═══╬═══╬═══╬═══╬═══╬═══╣");
}
else
{
Console.WriteLine(" ╚═══╩═══╩═══╩═══╩═══╩═══╩═══╩═══╝");
}
}
它正在工作,但您看不到它。
尝试
Console.Write(" ╔═══╦═══╦═══╦═══╦═══╦═══╦═══╦═══╗'n");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.BackgroundColor = ConsoleColor.Blue;