各位大佬,为什么VS2019控制台不能输出键盘键入的汉字呀,vscode也是这种情况,该怎么处理呢?

#include<iostream>
#include<string>
using namespace std;//caution
int main() {

    string  str = "hello";
    cout << "请输入str值为:" << endl;
    cin >> str;
    cout << "char的值为:" << str << endl;


    system("pause");
    return 0;

}

 

vscode右下角有个选项默认为UTF-8,点击之后,选择通过编码保存,找到Simplified Chinese(),就可以解决中文乱码的问题,不过还是建议尽快适应英文