[英]How can I print this“█” special character in C++?
我想在Visual Studio(c ++)中打印此特殊字符█,但得到“?” 。 我寫的相應代碼:
bool b[5][3] = { { true,true,true },{ true,false,true },{ true,false,true },
{ true,false,true },{ true,true,true } };
system("color 0A");
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 3; j++)
{
if (b[i][j])
{
gotoXY(3 + j, 5 + i);
cout << "█";
}
}
cout << endl;
}
試用: std::cout <<"\█";
█Unicode: U + 2588
您應該使用寬輸出:
::_setmode(::_fileno(stdout), _O_U16TEXT);
::std::wcout << L"█" << ::std::flush;
同樣,如果您打算使用偽圖形,則可能需要為控制台選擇某種像素字體,以便呈現符號時不會出現鋸齒和間隙。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.