Clion outputs Chinese garbled characters

As shown in the figure below, when printing through printf, if there is Chinese, it will print out garbled characters

Solution:

Just add the following statement to the main function, and the corresponding header file is

#include <windows.h>
system("chcp 65001");

After modification, as shown in the figure below:

Guess you like

Origin blog.csdn.net/zhangyuexiang123/article/details/117874312