Press any key.
Press any key...
vs编译简单c程序,防止结果一闪即逝
方案一、
引入头文件:#include <stdlib.h>
程序尾部加:system("pause");
实例代码:
#include <math.h> #include <stdio.h> #include <stdlib.h> int max(int x,int y); int main(){ int x,y,z; printf("input two numbers:\n"); scanf("%d%d",&x,&y); z=max(x,y); printf("maxnum=%d",z); system("pause"); } int max(int x,int y){ return x>y?x:y; }
方案二、
F5是调试,CTRL+F5是运行,调试是没有最后那一行Press any key的,所以一闪而逝。。。