C++中顯示中文問題
#include <iostream>
#include <clocale>//必須包含下面三個頭文件
#include <cwchar>
#include <cstdlib>
using namespace std;
int main()
{
wchar_t c[] = {L'你', L'好', L'中', L'國', L'歡', L'迎', L'你' };//使用寬字符型設置中文字符
//L 表示當前為寬字符
setlocale(LC_ALL, "chs");//設置語言為中文 頭文件#include<locale.h>
for (int i = 0; i < 7; i++)
{
wprintf(L"%lc", c[i]);//使用寬字符型輸出函數wprintf
}
cout << endl;
system("pause");
return 0;
}