Just change the encoding method of cmd or vscode. The specific method is as follows:
1. Enter the directory where the program is located and run the program. For example, my cpp program is in D:/c/test.exe:
2. After entering cmd, enter the following command:
D: 进入到驱动器 cd c 进入到 c 目录下 chcp 65001 转换编码方式 test.exe 运行程序
3. You can use the character encoding as utf-8 Next, the program will output Chinese.
vs code console:
chcp 65001 .\test.exe
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of vscode compile c console output garbled code. For more information, please follow other related articles on the PHP Chinese website!