課程
/后端開發
/C#
/C#開發輕松入門
咋做?。?br />
2017-11-26
源自:C#開發輕松入門 4-10
正在回答
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for(int i=1;i<=7;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for(int j=1;j<=7;j++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if(i==j || i+j==8)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("0");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ?Console.WriteLine();
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? }
? ? }
}
using System.Linq;
using System.Threading.Tasks;
namespace Test01
? ? ? ? ? ? const int n = 7;
? ? ? ? ? ? for (int y = 1; y <= n; y++)
? ? ? ? ? ? ? ? for (int x = 1; x <= n; x++)
? ? ? ? ? ? ? ? ? ? if (x == y || x == n - y + 1)
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? Console.WriteLine();
static void Main(string[] args)
? ? ? ? ? ? for(int i=1;i<8;i++)
? ? ? ? ? ? ? ? for(int j=1;j<8;j++)
? ?? ? ?}
主要的點就是 if 那判斷是不是在對角線上
舉報
本門課程是C#語言的入門教程,將帶你輕松入門.NET開發
2 回答求大神解答
4 回答大神求解答
2 回答求大神教我
1 回答求解惑大神
3 回答求解 大神們
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2018-04-25
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for(int i=1;i<=7;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for(int j=1;j<=7;j++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if(i==j || i+j==8)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("0");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ?Console.WriteLine();
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? }
? ? }
}
2018-04-22
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test01
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? const int n = 7;
? ? ? ? ? ? for (int y = 1; y <= n; y++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for (int x = 1; x <= n; x++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if (x == y || x == n - y + 1)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();
? ? ? ? ? ? }
? ? ? ? }
? ? }
}
2017-11-26
static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? for(int i=1;i<8;i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? for(int j=1;j<8;j++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? if(i==j || i+j==8)
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write("O");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? Console.Write(".");
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine();
? ? ? ? ? ? }
? ?? ? ?}
主要的點就是 if 那判斷是不是在對角線上