第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

求大神講解一下思路

這個代碼應(yīng)該怎么敲,最好把自己看到這道題的思路詳細的說一下。謝謝大神了!

正在回答

6 回答

????????????????int x=1; //輔助判斷
??????????? //外層循環(huán)控制輸出多少行(用a--方便后面輸出o)
??????????? for(int a=7;a>=1;a--){
??????????????? //內(nèi)層循環(huán)控制輸出多少列
??????????????? for(int b = 1;b<=7;b++){
??????????????????? //控制一行中哪一列輸出 o,哪一列輸出 .
??????????????????? if(b==x || b==a){ //當b==x時,每一行按 第1 2 3 4 5 6 7 位輸出o(也就是示例圖上從左到右的 o)

????????????????????????????????????????????????//當b==a時,每一行按 第7 6 5 4 3 2 1 位輸出o(也就是示例圖從右到左的 o)

??????????????????????? Console.Write("o");
??????????????????? }else{
??????????????????? Console.Write(".");
??????????????????? }
??????????????? }
??????????????? x++;
??????????????? Console.WriteLine();
??????????? }

//(這種形式的,一般都是先外層循環(huán)控制多少行,然后內(nèi)層循環(huán)控制每一行有多少列,然后控制每一行輸出什么)

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_朱與墨的晴霜_0

你這個回答有問題吧
2018-08-03 回復(fù) 有任何疑惑可以回復(fù)我~
#2

阿龍0326

個人認為,沒必要定義x那個變量
2018-10-20 回復(fù) 有任何疑惑可以回復(fù)我~

? ? ? ? static void Main(string[] args)

??????? {
??????????? //請完善代碼
??????????? for(int i = 0;i<7;i++)
??????????? {
??????????????? for(int j = 0;j<7;j++)
??????????????? {
??????????????????? if(i == j||i==6-j)
??????????????????????? Console.Write("O");
??????????????????? else
??????????????????????? Console.Write(".");
??????????????? }
??????????????? Console.WriteLine();
??????????? }
??????? }


0 回復(fù) 有任何疑惑可以回復(fù)我~


? ? ? ? static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? //請完善代碼

? ? ? ? ? ? for (int i = 1; i <= 7; i++)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? for (int j = 1; j <= 7; j++)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? if (j == 8 - i || j == 8 - (8 - i))

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? Console.Write("0");

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? else

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? Console.WriteLine("");

? ? ? ? ? ? }

? ? ? ? }


0 回復(fù) 有任何疑惑可以回復(fù)我~

?static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? int z =7;

? ? ? ? ? ? for(int x=1;x<=7;x++){

? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ?for(int y=1;y<=7;y++){

? ? ? ? ? ? ? ? ? ? ?if(y==x||y==z){

? ? ? ? ? ? ? ? ? ? ? ? ?Console.Write("O");

? ? ? ? ? ? ? ? ? ? ?}else{

? ? ? ? ? ? ? ? ? ? ? ? ?Console.Write(".");

? ? ? ? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ? ?}

? ? ? ? ? ? ? ? ?z--;

? ? ? ? ? ? ? ? ? Console.WriteLine(" ");

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? }


0 回復(fù) 有任何疑惑可以回復(fù)我~

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;y<=7;y++)

? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ?string text= x==y||x+y==8 ? "O": ".";

? ? ? ? ? ? ? ? ? ?Console.Write(text);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? Console.WriteLine();

? ? ? ? ? ? }

? ? ? ? }

? ? }

}


5 回復(fù) 有任何疑惑可以回復(fù)我~

首先二維數(shù)組的位置編號二維數(shù)組左上角的是(0,0)

示例如下

{

(0,0)? (0,1)?? (0,2)

(1,0)? (1,1)?? (1,2)

(2,0)? (2,1)?? (2,2)

}

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
C#開發(fā)輕松入門
  • 參與學習       255743    人
  • 解答問題       1527    個

本門課程是C#語言的入門教程,將帶你輕松入門.NET開發(fā)

進入課程

求大神講解一下思路

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號