C语言中为什么输出的内容闪一下就没了?

这段
#include<stdio.h>
main()
{
printf("hello");
}

生成.exe后点击 闪一下就没了,看不到输出的内容 威为什么?

因为tc的运行就是这样的,运行完毕后返回代码页面。
你可以选择菜单里的显示屏幕项显示,或者在代码末尾加上getch();来让程序停止在结尾,这样每次运行程序都会看到结果了。
#include<stdio.h>
main()
{
printf("hello");
getch();
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2006-06-07
先运行CMD,然后把文件拖到CMD的窗口,回车!!!
第2个回答  2006-06-07
在后面加一句getchar()
#include<stdio.h>
main()
{
printf("hello");
getchar();
}本回答被提问者和网友采纳
第3个回答  2006-06-07
在程序后面加上 getch(); 暂停屏幕
第4个回答  2006-06-07
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("hello");
system("pause");
}
相似回答