我用vc++6.0写c语言。程序在vc++6.0内运行很正常,但直接打开生成的exe就只闪一下就没反应了

代码如下:
#include <stdio.h>
void main()
{
printf ("holle.\n")
}

第1个回答  2012-04-21
#include<conio.h>
#include <stdio.h>
int main()
{
printf ("holle.\n");

getch();
}

不是没运行,是运行后关闭了追问

#include和getch();是什么意思
如果是:
#include
void main()
{
int max(int x,int y);
int a,b,c;
scanf("%d,%d",&a,&b);
c=max(a,b);
printf("max=%d\n",c);
}

int max(int x,int y)
{
int z;
if (x>y) z=x;
else z=y;
return (z);
}
哪怎么改

追答

#include 是 getch()函数的头文件,getch()是准备接受一个输入
c=max(a,b);
printf("max=%d\n",c);
getch();

本回答被提问者采纳
第2个回答  2012-04-21
那是正常的。一般可以在main函数结尾添加system(“pause”)或者getchar()。
第3个回答  2012-04-21
程序运行完了当然要关掉了,加个函数。
#include <stdio.h>
void main()
{
printf ("holle.\n")
getchar();
}追问

你这个都不行

相似回答