方法有二: 在 return 0 前加上 getch() ,则程序运行结束后,等待键入 “回车” 退出。写入头文件 #include <stdlib.h>; 然后在return 0 前加上 system(“pause”);