Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/141.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Qt函数比较两个汉字_C++_Qt - Fatal编程技术网

C++ Qt函数比较两个汉字

C++ Qt函数比较两个汉字,c++,qt,C++,Qt,我创建了一个程序,我需要比较两个汉字 我使用此函数比较: void fengshuitradition::comparerAuto() { Stockage obj_stockage; Lunar lunar; LunarObj* obj = lunar.solar2lunar(ui->SBSelection_4->value(), ui->SBSelection_3->value(), ui->SBSelection_2->value

我创建了一个程序,我需要比较两个汉字

我使用此函数比较:

void fengshuitradition::comparerAuto()
{
    Stockage obj_stockage;
    Lunar lunar;
    LunarObj* obj = lunar.solar2lunar(ui->SBSelection_4->value(), ui->SBSelection_3->value(), ui->SBSelection_2->value());
    string day = obj->ganzhiDay;
    for(int i = 0; i<64; i++)
    {
        string jourComparer = obj_stockage.appelStockage(i,1);
        string jourComparer2 = obj_stockage.appelStockage(i,2);
        if (day.compare(0,6,jourComparer,0,6) == 0 && day.compare(7,6,jourComparer2,0,6) == 0)
        {
            ui->label_0->setText(obj_stockage.appelStockage(i,0));
            ui->label_1->setText(obj_stockage.appelStockage(i,1));
            ui->label_2->setText(obj_stockage.appelStockage(i,2));
            ui->label_3->setText(obj_stockage.appelStockage(i,3));
            ui->label_4->setText(obj_stockage.appelStockage(i,4));
            ui->label_5->setText(obj_stockage.appelStockage(i,5));
            ui->label_6->setText(obj_stockage.appelStockage(i,6));
            return;
        }
    }
}
我使用图书馆:

static std::string Gan[] = {"\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"};


static std::string Zhi[] = {"\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"};

谢谢您的帮助。

对不起,我不明白您的问题,您能帮我翻译一下吗?如果您已经有Qt,您可能想使用QString,它们是UTF-16并提供LocalAwarePrepare
static std::string Gan[] = {"\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"};


static std::string Zhi[] = {"\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"};