为什么C的语句在DEV C++里运行不起啊!

来源:百度知道 编辑:UC知道 时间:2024/06/15 13:21:25
#include <stdio.h>

int main()
{int a,b,c,max;
printf("Input a,b,c value : ");
scanf("%d,%d,%d",&a,&b,&c);
if (a>b) max=a; else max=b;
if (c>max) max=c; else ;
printf("Max=%d\n",max);
}
这个,在vc里可以的!在DEVC++不行!高手指教啊!

VC运行的时候会自动在程序末尾加上一句 system("pause");
而DEVC++是直接运行可执行程序
所以你输入数据以后
输出结果就会一闪而过
你在程序最后加上一句:
getchar();
就可以了。

改为如下形式:

//---------------------------------------------------------------------------
#include <stdio.h>

int main(void)
{int a,b,c,max;
printf("Input a,b,c value : ");
scanf("%d,%d,%d",&a,&b,&c);
if (a>b) max=a; else max=b;
if (c>max) max=c; else ;
printf("Max=%d\n",max);

return 0;
}
//---------------------------------------------------------------------------

那句运行不了你把程序写出来看看啊

如果你使用了c++的命名空间,如:using namespace std,那么c的一些特性将受到限制,建议:如果c和c++混写(当然不提倡这种方法)使用.h的头文件,并且不要声明命名空间

另外,就是一些c的标准库函数,在DEV c++ 里函数前要加下划线"_"或"__",而在VC6.0里则不需要