vc6的问题

来源:百度知道 编辑:UC知道 时间:2024/06/06 19:52:14
#include <stdio.h>
main()
{
int fahr,celsius;
int lower,upper,step;

lower = 0;
upper = 300;
step = 20;

fahr = lower;
while (fahr <= upper)
{
celsius = 5 * (fahr-32) / 9;
printf("%d\t%d\n",fahr,celsius);
fahr = fahr + step;
}
getch();
}
我用TC编译通过
为何用VC++6不行呢?

============================
--------------------Configuration: wendu - Win32 Debug--------------------
Compiling...
StdAfx.cpp
Compiling...
wendu.cpp
g:\wendu\wendu.cpp(20) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

wendu.exe - 1 error(s), 0 warning(s)
#include <stdio.h>

main(int)
{
float fahr,celsius;

int main()//main函数需要类型 也可以写成
//void main 就不需要写后面的return了
{
....... //前面就是你写的 程序
return 0; //放在最后
}

我的vc++6能编译通过

Tc != VC
main 带上返回值 int
然后main 买你的右}之前 带上return(0);试试
请参看下C++标准