错码改写
#include<iostream.h>void main()
{
char a[]="计算机";
cout<<a[1];
}
为什么输出的不是“算”而是不认识的字?
#include<iostream.h>
void main()
{
char a[]="计算机";
cout<<a;
}
而这却能输出"计算机"
#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