C++中设置所有字符为简体中文

来源:互联网 发布:淘宝客云建站官网 编辑:程序博客网 时间:2024/05/16 04:53

#include <iostream>

#include <locale>

using std::wcout;

using std::endl;

int main()

{

setlocale(LC_ALL,"chs"); ///设置所有字符为简体中文

wchar_t wt[]=L"";   //声明宽字符类型变量,L告诉编译器分配两个字节的空间

wcout<<wt<<endl;     //输出用wcout

return 0;

 

}

 

#include <iostream>

using namespace std;

int main()

{

cout<<"int:"<<sizeof(int)<<endl;  //16b机中2B,除此之外4B

cout<<"short:"<<sizeof(short)<<endl;  //固定2B

cout<<"long:"<<sizeof(long)<<endl;   //固定4B

return 0;

 

}

0 0
原创粉丝点击