為什么提交之后沒反應,而如果有明顯錯誤的話會報錯
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? for (int x=1;x<=7;x++)//請完善代碼
? ? ? ? {
? ? ? ? ? ? for (int y=1;x<=7;y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (x+y==8||x==y)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? Console.WriteLine();
? ? ? ? }
? ? ? ? }
? ? }
}
2022-08-15
?for (int y=1;x<=7;y++)
這里第二個循環條件錯了,把x改為y即可,設置為x就會讓第二層循環沒辦法跳出循環造成死循環。