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