4-10可行

来源:4-10 编程练习

qq_慕妹3395683

2019-05-28 00:01

for(int x=1;x<8;x++)//请完善代码
            {
                for(int y=1;y<8;y++)
            {
               if(y<7)
               {
                if(x==y||(x+y)==8)
                Console.Write("o");
                else
                 Console.Write(".");
               }
               else
               {
                 if(x==y||(x+y)==8)
                Console.WriteLine("o");
                else
                 Console.WriteLine("."); 
               }

写回答 关注

2回答

  • 慕瓜5867250
    2019-08-06 17:11:47
    for (int x = 1; x < 8; x++)//请完善代码            {                for (int y = 1; y < 8; y++)                {                    {                        if (x == y || (x + y) == 8)                            Console.Write("o");                        else                            Console.Write(".");                    }                                 }                Console.WriteLine();            }

    我帮你删掉一点代码

  • qq_慕妹3395683
    2019-05-28 00:02:24

    for(int x=1;x<8;x++)//请完善代码
                {
                    for(int y=1;y<8;y++)
                {
                   if(y<7)
                   {
                    if(x==y||(x+y)==8)
                    Console.Write("o");
                    else
                     Console.Write(".");
                   }
                   else
                   {
                     if(x==y||(x+y)==8)
                    Console.WriteLine("o");
                    else
                     Console.WriteLine("."); 
                   }

C#开发轻松入门

本门课程是C#语言的入门教程,将带你轻松入门.NET开发

254118 学习 · 1459 问题

查看课程

相似问题