如何在C ++中正确打印unicode字符?

问题描述

我已经打印出一张井字游戏桌,在其中我用希腊字母作为要用数字代替的数字(我会要求人们用叉号(X)或像典型的井字游戏一样圈(0)。

大声笑我很难打印出希腊字符。我正在使用它们的unicode值将其打印出来。但是,结果却是胡说八道(输出黄色图像)。我该如何解决?(使用代码::块)

#include <iostream>
using namespace std;
int main(){
 char a = '\u03b1';
    char b = '\u03b2';
    char c = '\u03b3';
    char d = '\u03b4';
    char e = '\u03b5';
    char f = '\u03b6';
    char g = '\u03b7';
    char h = '\u03b8';
    char i = '\u03b9';



    cout<< "               |               |               "<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "      "<<a<<"        |      "<<b<<"        |      "<<c<<"        "<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "_______________|_______________|_______________"<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "      "<<d<<"        |      "<<e<<"        |      "<<f<<"        "<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "_______________|_______________|_______________"<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "      "<<g<<"        |      "<<h<<"        |      "<<i<<"        "<<endl;
    cout<< "               |               |               "<<endl;
    cout<< "               |               |               "<<endl;
}

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)