fatal error C1083: 无法打开包含文件:“iostream.h”: No such file or directory

iostream.h已经不被.net支持了,你要用的话加上using namespace std;
#include "stdafx.h" 
#include 
using namespace std;
int _tmain(int argc, _TCHAR* argv[]) 
{ 
cout<<"hello"< 
  
另外:
转自:http://hi.baidu.com/laddie10/blog/item/079b1d4c32d7d8fcd62afc25.html


C++中新定义的方法都是有名字空间的 比如cout就属于std名字空间 如果include头文件的时候加上.h,默认会using namespace 否则需要自己加上 using namespace XXX 对于C中已经定义的方法如printf,没有影响的


iostream.h是包含输入/输出流处理的头文件,iostream就什么都不是了 
但用iostream要加名词空间namespace


#include 
或者是 
#include 
using namespace std; 
二者都行


#include是C语言中比较通用的 
#include 
using namespace std; 
是C++中比较通用的
 
  
百度看到的:
 
  
#include 非标准输入输出流
#include 标准输入输出流

C++中为了避免名字定义冲突,特别引入了“名字空间的定义”,即namespace。
当代码中用时,输出可直接引用cout<继承C语言的标准库文件,未引入名字空间定义,所以可直接使用。
当代码中引入时,输出需要引用std::cout<时,引入std::有以下方法:

1.
using namespace std;
cout<时,
要用using namespace std;了吧。如果你不用这个,就要在使用cout时,用后两种方法了。
其他头文件也是同样的道理。
(有“.h”的就是非标准的,C的标准库函数,无“.h”的,就要用到命令空间,是C++的。还有一部分不完全是有“.h”和没“.h”的差别。例如:math.h和cmath)

你可能感兴趣的:(c++简单教程)