#include
int main()
{
printf("hello world\n");
getchar() ; //等待输入一个回车再结束
}
你用的是windows开发工具,窗口在程序运行完就会自动关闭。
在你main函数体的最后加一句
system("pause");
调用系统的暂停功能,让后台出现的程序执行窗口暂停关闭
你就能看到了。
同时你要加一个头文件包含这个system函数
比如:
#include "stdio.h"
#include "stdlib.h"
void main()
{
printf("Hello World!\n");
system("pause");
}
你运行的是不是编好的程序?是的话,就会出现这种情况,原因就是程序运行完后会自动关闭。你可以在程序后加一个getchar(),举个例子:
#include
void main()
{
printf("hello\n");
getchar();
}
给你解释一下,“\n”是换行符。
你是不是用的微软的c?不要点运行,点那个键左边的那个键,具体叫什么我忘了,好久不用了。。考完2j证就扔了= =
用的是什么编译器?可以试试加一句getchar();,或者按ctrl+f5编译。