错码改写
#include<iostream.h>void main()
{
char a[]="计算机";
cout<<a[1];
}
为什么输出的不是“算”而是不认识的字?
#include<iostream.h>
void main()
{
char a[]="计算机";
cout<<a;
}
而这却能输出"计算机"
2011-09-24 22:42
2011-09-25 00:15
2011-09-25 01:09
2011-09-25 01:59
2011-09-25 10:56
程序代码:#include<iostream>
using std::wcout;
using std::locale;
using std::endl;
void main() {
wchar_t a[]=L"计算机";
wcout.imbue(locale("chinese"));
wcout<<a[1]
<< endl;
}
这样子就可以输出中文了..具体的可以在这里看看http://hi.baidu.com/bevan_007/blog/item/a1f1798b173cd5dafd1f105c.html
2011-09-25 12:49
2011-09-25 12:50
2011-09-25 12:52
2011-09-25 12:56
2011-09-25 12:59