❶ C语言,编完程序后,运行,显示“编译成功”,但是接着弹出的黑色背景显示框,却一闪就没有了。
编译不会弹出窗口的。运行的时候会。例子:#include
void
main(){
printf("hello
world\n");}程序运行后,窗口弹出又消失,很快,这是程序已经运行完成,可以用alt+f5查看结果,就是调出刚开弹出的黑窗口。当然,这样很烦人,可以稍微修改下程序,让程序运行后不是直接关闭窗口。#include
void
main(){
printf("hello
world\n");
getch();}这样程序运行后,在getch()这里停留,等待一个键盘输入才结束整个程序。
❷ c语言程序执行一闪而过怎么办
可以在程序结尾使用system("pause");语句阻止窗口消失。
system("pause");的头文件为#include<stdlib.h>
#include<stdio.h>
#include<stdlib.h>
void to_upper_str( char *str ) //子函数
{
while( *str )
{
if( *str >='a' && *str<='z' )
*str -= 32;
str++;
}
}
int main(){
char str[11] ;
printf("请输入10个英文字符: ");
scanf("%s",str);
str[10]='