(刚开始上c语言)运行C++程序时窗口一闪而过,看不见结果
答案:6 悬赏:0
解决时间 2021-01-18 22:06
- 提问者网友:富士山上尢
- 2021-01-17 21:34
(刚开始上c语言)运行C++程序时窗口一闪而过,看不见结果
最佳答案
- 二级知识专家网友:duile
- 2021-01-17 22:36
因为你的运行窗口在程序一结束就关闭了,所以要加一个等待键,才能保证窗口不关闭。
#include
int main()
{
printf("hello!\n");
getchar(); //等待输入回车再结束
return 0;
}
#include
int main()
{
printf("hello!\n");
getchar(); //等待输入回车再结束
return 0;
}
全部回答
- 1楼网友:洒脱疯子
- 2021-01-18 03:07
最后加上一句
system("pause");
或者
getch();
主要看你系统支持标准库还是。。
system("pause");
或者
getch();
主要看你系统支持标准库还是。。
- 2楼网友:拾荒鲤
- 2021-01-18 01:56
没写输出语句
- 3楼网友:平生事
- 2021-01-18 01:09
不想改程序的话,还有一个方法:
进入到cmd命令行中运行你的程序,输出结果想看多久都可以
进入到cmd命令行中运行你的程序,输出结果想看多久都可以
- 4楼网友:北城痞子
- 2021-01-17 23:48
#include
#include
int main()
{
printf("hello!\n");
system("pause"); //用于防止闪退
return 0;
}
#include
int main()
{
printf("hello!\n");
system("pause"); //用于防止闪退
return 0;
}
- 5楼网友:毛毛
- 2021-01-17 23:15
加上个getchar();
#include
int main()
{
printf("hello!\n");
return 0;
getchar();
}
#include
int main()
{
printf("hello!\n");
return 0;
getchar();
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯