注册 登录
编程论坛 C++教室

为什么显示“无法打开包括文件:“iostream.h”: No such file or directory”

流年似水1234 发布于 2014-10-23 22:29, 19788 次点击
#include<iostream.h>
#include<stdlib.h>
class counter
{
    static int count;
    int objnumber;
    public:
        counter()
        {
            count++;
            objnumber=count;
        }
        void show()
        {
            cout<<"obj"<<objnumber<<" ";
            cout<<"cout="<<count<<"\n";
        }
};

int counter::count=0;


main()
{
    counter obj1;
    obj1.show();
    cout<<"------------------";
    counter obj2;
    obj1.show();
    obj2.show();
    cout<<"----------------------";
    counter obj3;
    obj1.show();
    obj2.show();
    obj3.show();
    return 1;
}
8 回复
#2
stop12042014-10-24 10:06
#include <iostream>
#include "iostream"
#3
zhu4044241182014-10-24 15:49
没有使用命名空间
using namespace std;
#4
zklhp2014-10-24 15:56
代.h的这些头文件是非常老的标准里面的了 早就淘汰了
#5
stop12042014-10-24 23:41
C的头文件都是带 .h
C++头文件大部分都是在旧的C头文件前加个 c    如 cstdlib  cmath  cfloat  对应的就是stdlib.h  math.h   float.h
#6
qwe8851677592014-10-25 23:00
没错啊,完全正确啊
#7
奔跑的邮递员2014-10-30 20:06
回复 楼主 流年似水 1234
不是应该RETURN 0吗?
#8
zcdjt2014-10-30 20:59
同意二楼和五楼。
#9
沱游星空2014-10-31 17:55
试试改为
#include "iostream"
using namespace std;
1