我想要的是显示用户输入的带有中文字母的行。虽然程序 DevC++。
这是我的代码:
#define UNICODE
#include <iostream>
#include <string>
using namespace std;
extern wostream wcout;
int main(int argc, char** argv) {
std::wstring kanji = L"?";
//std::wchar_t stop = L"0";
std::wcout << L"\n\nWelcome to the Chinese letter program\n";
std::wcout << L"The program will ask you for one Chinese letter\n";
std::wcout << L"Then press enter, and a message will display.\n";
std::wcout << L"Once you are done,you can enter another Chinese letter\n";
std::wcout << L"To exit just close the Ubuntu's terminal'\n\n";
for(int x = 0; x < 80; x++){
std::wcout << L"Give me one Chinese letter...";
wcin >> kanji;
std::wcout << L"The Chinese letter is \"" << kanji << "\".\n\n";
}
return 0;
}
对我来说重要的是“中文字母是“(汉字)”。线。当我按照程序说的做时,我得到“中文字母是“?”。所以问题是 DevC++ 没有正确显示中文字母,即使我使用 wcin 和 wcout 的东西。
注意我在 Ubuntu 上通过 wine 使用 DevC++。