錯(cuò)誤在哪里呢?
? ? ? ? ? ? for (int x=1;x<=7;x++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int y=1;y<=7;y++)
? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? if (x==y||x+y==8)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();
? ? ? ? ? ? ??
? ? ? ? ? ? }
2022-03-27
是不是分號(hào)是中文狀態(tài)下的,改成英文狀態(tài)下的試試希望你繼續(xù)支持慕課網(wǎng):P
2017-06-28
? ? ? for (int x = 1; x <= 7; x++)//循環(huán)7行
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int y = 1; y <= 7; y++)//循環(huán)7列
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if (x == y || x + y == 8)//對(duì)角線打印O
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");//其他位置打印.
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();//換行
? ? ? ? ? ? }
2017-02-25
2017-02-25
if(x==y || x+y==8)里面括號(hào)用成中文了
貼上正確的代碼: