首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

Press any key.

2012-11-07 
Press any key...vs编译简单c程序,防止结果一闪即逝?方案一、引入头文件:#include stdlib.h程序尾部加:sy

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的,所以一闪而逝。。。

热点排行