控制台应用程序的打印与在线编译器不同

问题描述 投票:0回答:1

我正在编写一个连接4的程序,效果很好。唯一的问题是在Visual Studio中,方法

    public static void Display(char[,] board)
    {
        Console.Clear();
        for (int i = 1; i < 8; i++)
        {
            Console.Write(" " + i);
        }
        Console.WriteLine();
        for (int j = 0; j < 15; j++)
        {
            Console.Write("_");
        }
        Console.WriteLine();
        for (int i = 0; i < 6; i++)
        {
            for (int j = 0; j < 7; j++)
            {
                Console.Write("|" + board[i, j]);
            }
            Console.WriteLine('|');
        }
        for (int j = 0; j < 15; j++)
        {
            Console.Write("¯");
        }
        Console.WriteLine();
    }

将最后一个for循环打印得太低。这是不够的。应该是这样(在repl中有效)enter image description here

但是被打印成这样(在VS中enter image description here] >>

[我试图用¯代替〜,但它只是打印出问号??????????

我正在编写一个连接4的程序,效果很好。唯一的问题是,在Visual Studio中,方法public static void Display(char [,] board){Console.Clear();为(...

c# printing console read-eval-print-loop
1个回答
2
投票

为什么不使用旧的Box Drawing字符?

© www.soinside.com 2019 - 2024. All rights reserved.