Home  >  Q&A  >  body text

C++使用cout输出中文,打印出来的全是问号

就只是很简单的代码,结果打印出来的是一排问号:????????。我改了下字符集,不管是unicode还是多字节,都不能正常显示,我用的是vs2015。

void main()
{
    cout << "输入字母" << endl;
}
PHP中文网PHP中文网2713 days ago1303

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 13:45:54

    It is estimated that the encoding format of your source file is different from the format of the Windows console. You can try outputting to a file and then opening the output file. There should be no garbled characters.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 13:45:54

    The console under windows uses gbk encoding. Your output is unicode.

    reply
    0
  • Cancelreply