头文件的问题
《 The C++ Programing Language 》第三章 有如下程序:
#include<iostream>
int main(){
std:cout<<"Hello Word!\n";
return 0
}
我在Vc++ 6.0 下编译如下错误:
f:\c++\teststring\teststring.cpp(3) : error C2065: 'cout' : undeclared identifier
f:\c++\teststring\teststring.cpp(3) : error C2297: '<<' : illegal, right operand has type 'char [13]'
f:\c++\teststring\teststring.cpp(4) : warning C4508: 'main' : function should return a value; 'void' return type assumed
Error executing cl.exe.
TestString.exe - 2 error(s), 1 warning(s)
记学C++的时候 是 #include<iostream.h>
改为#include<iostream.h> 通过
继续:
#include<iostream.h>
#include<string.h>
string name = "Hello Word";
int main(){
std:cout<<name<<"!\n";
return 0
}
还是有错误!
莫非这本书上面的程序是要在.net 下编译的?
菜鸟 莫笑:)