如何在控制台窗口中打印“☻”这个单词?(c / c ++)

时间:2016-04-19 06:28:49

标签: c++

wcout.imbue(std::locale("chs"));
wchar_t *a = L"☻";
wcout << *a;

这不行,为什么?我该怎么办?

3 个答案:

答案 0 :(得分:2)

可能的错误:

  • 您的编译器可能无法将Option Explicit Sub main() Dim sht As Worksheet, listSht As Worksheet Dim listRng As Range, found As Range Set listSht = ThisWorkbook.Worksheets("List") With listSht Set listRng = .Range("A3:A" & .Cells(.Rows.Count, "A").End(xlUp).Row) 'sets the list range dowwn to the last non empty cell in column "A" of "List" sheet End With For Each sht In ThisWorkbook.Worksheets If sht.Name <> listSht.Name Then Set found = listRng.Find(what:=sht.Range("A1").Value, LookAt:=xlWhole, LookIn:=xlValues, MatchCase:=True) If Not found Is Nothing Then found.Offset(, 1).Copy Destination:=sht.Range("B1") End If Next End Sub 识别为源文件中的unicode字符串。
  • 您的控制台不支持

您可以使用unicode字符代码(L"☻")。确保控制台支持unicode,并且字体具有相应的字符。

对于C ++ 11,使用unicode character literals也可能更容易(取决于编译器支持);

"\u263B"

答案 1 :(得分:0)

它的Unicode 263B source

简单使用confirmViewController.m;

答案 2 :(得分:0)

这应该有用(u8以后c++11):

char smiley[] { u8"\u263b" };
cout << smiley << '\n';

或者您也可以这样做:

char smiley[] { "\u263b" };
cout << smiley << '\n';