呵呵哒改不成名字
2015-10-07 18:29
为什么我把这个程序打入,显示的是这个
里面的for循环输出写成了Console.WriteLine();是吧。
Console.WriteLine();有换行的效果。
Console.Write();没有换行的效果。
参考代码
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++)//循环7行
{
for (int y = 1; y <= 7; y++)//循环7列
{
if (x == y || x + y == 8)//对角线打印O
{
Console.Write("O");
}
else
{
Console.Write(".");//其他位置打印.
}
}
Console.WriteLine();//换行
}
}
}
}
C#开发轻松入门
256769 学习 · 1528 问题
相似问题