2
我試圖創建一個使用斜線和破折號的堡壘,我需要使用macron(overscore)。我嘗試了幾種方法,但沒有一個能夠工作。任何想法如何使其工作?而不是Macron我得到'?'cron控制檯應用程序中的Macron
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace kingsdom
{
class Program
{
static void Main(string[] args)
{
int n = int.Parse(Console.ReadLine());
string ups = new string ('^', n/2);
string midUps = new string('_' ,(n * 2) - (((n/2) * 2) + 4));
string whitespaces = new string(' ', (n * 2) - 2);
string downs = new string('_', n/2);
string midDowns = new string('\u203E', (n * 2) - (((n/2) * 2) + 4));
Console.WriteLine("{0}{1}{2}{3}{0}{1}{2}", "/", ups, "\\", midUps);
for (int i = 0; i < n - 2; i++)
{
Console.WriteLine("{0}{1}{0}", "|", whitespaces);
}
Console.WriteLine("{0}{1}{2}{3}{0}{1}{2}", "\\", downs, "/", midDowns);
}
}
}
究竟是什麼問題?你的代碼似乎對我很好。 – Chris
@Chris而不是Macron我得到「?」 – VG98
這可能意味着您的字體不支持該字符。嘗試https://dotnetfiddle.net/DOyG5w,希望能夠工作(您的瀏覽器可能具有unicode字體)。 – Chris