发新话题
打印

why i can not pass the compile

why i can not pass the compile

this is the code::

#include <iostream>

class cls
{
int i;
public:
cls()
{
        cout<<"cls set up "<<endl;
}
~cls()
{
        cout<<"cls over"<<endl;
}
};
main()
{
        cout<<"start"<<endl;
        {
                cls test;
        }
        cout<<"end"<<endl;
        return 0;
}

this is error message::

class1.cpp: In constructor 'cls::cls()':
class1.cpp:9:'cout' undeclared(first use this function)
class1.cpp:9Each undeclared identifier is reported only once for each function it appears in.)
class1.cpp:9:'endl' undeclared(first use this function)


how can i do ?????

if i change the "#include <iostream>" with the "#include <iostream.h>",it will pass! but why???      

TOP

sorry! i was in linux. i had to use english !      

TOP

#include <iostream>
using namespace std;      
-----------------------------------------
http://www.darkspy.org/blog

自大的人把宗教当迷信,无知的人把迷信当宗教

TOP

发新话题