用dev-c++输出命令行,为啥闪一下就关了,怎样解决???

来源:百度知道 编辑:UC知道 时间:2024/05/16 15:34:02
高手们!!!!我已经郁闷了几天了,到底是怎么回事啊
除了在后面叫getchar()之外还有没有更彻底地办法????

程序结束前加上system("PAUSE");头文件 stdlib.h
比如:
#include<stdio.h>
#include<stdlib.h>

int main()
{
printf("Hello World!\n");
system("PAUSE");
return 0;
}
或者加getch();头文件conio.h
比如:
#include<stdio.h>
#include<conio.h>

int main()
{
printf("Hello World!\n");
getch();
return 0;
}

在最后一行加个getch()试试吧