懂C++编程的能帮我解决这个问题吗?

来源:百度知道 编辑:UC知道 时间:2024/06/06 02:55:57
我编了一个程序
#include<iostream.h>
void main()
{cout<<"hello c++"<<endl;
}
但有一个错误找不出来,能帮忙吗?我现在是菜鸟,没办法!
答案可发至我邮箱westpointat1987@sina.com
兄弟们的方法都试过了,还是没解决问题!

程序正确 只是编译器的问题
vc 6.0 7.0 (vc.net2001) 可以通过
后期版本 vc.net 2003 、2005由于去掉了老库文件
必须将头文件改成如下:
#include<iostream>
using namespace std;

即可通过

main()必须返回int类型。正常结束返回0。
#include<iostream.h>
int main()
{
cout<<"hello c++"<<endl;
return 0;
}
另外,在新编译器下最好用<iostream>,而不是<iostream.h>,下面加using namespace std;

改为
#include<iostream>
using namespace std;
int main()
{
cout<<"hello c++"<<endl;
}

是这样,不同的版本用不同的写法
VC++6.0、Dev-C++用
#include<iostream>
using namespace std;
TC++3用:
#include<iostream.h>

你把错误的提示发过来
QQ:35707492

程序在VC60.0中编译通过

可能编译器的问题