64,281
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <locale>
using namespace std;
int main(void)
{
/************************************************************************/
/* 第一种方式 */
/************************************************************************/
//locale loc("chs");
//wcout.imbue(loc);
/************************************************************************/
/* 第二种方式 */
/************************************************************************/
setlocale(LC_ALL,"chs"); /* 简体中文,另外有几种等价的方式 */
wcout << L"中国" << endl;
return 0;
}
#include <string>
#include <iostream>
using namespace std;
int main()
{
wstring s(L"hello world!");
wcout<<s<<endl;
return 0;
}
输出:
hello world!