課程
/后端開發(fā)
/C#
/C#開發(fā)輕松入門
兩個(gè)for為什么一個(gè)是代表行一個(gè)是代表列呢?
2018-04-27
源自:C#開發(fā)輕松入門 4-10
正在回答
內(nèi)層的for用于輸出.和o 外層只用來?yè)Q行
愛學(xué)習(xí)的小張 提問者
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();
? ? ? ? ? ? }
?for(int x =1;x<=7;x++)
? ? ? ? ? ? ? ? for(int y =1;y<=7;y++)
? ? ? ? ? ? ? ? ? ? if(y==x||y==7-x+1)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ??
? ? ? ? ? ? ? ? Console.WriteLine("");
舉報(bào)
本門課程是C#語(yǔ)言的入門教程,將帶你輕松入門.NET開發(fā)
1 回答一個(gè)搞不懂的問題
3 回答不明白哪里寫的不對(duì)
3 回答4-10的題不會(huì)做,求解
1 回答這樣不是更快?少了一個(gè)for
1 回答4-10問題答案
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2018-05-11
內(nèi)層的for用于輸出.和o
外層只用來?yè)Q行
2018-05-21
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();
? ? ? ? ? ? }
2018-04-27
?for(int x =1;x<=7;x++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for(int y =1;y<=7;y++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if(y==x||y==7-x+1)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine("");
? ? ? ? ? ? }