关于iostream和c++命名空间
c++标准库函数都在std这个命名空间中,想要使用必须加上using namespace std,下面给出几种使用方法
1. specify the identifier directily, for example std::ostream instead of ostream. the complete sentence is as follows:
std :: cout << std :: hex << 3.4 << std :: endl;
2. using the "suing" key word
using std :: cout;
using std :: endl;
The above code can be written as
cout << std :: hex << 3.4 << endl;
3. the most convenient is to useing namespace std
all identifier defined in namespace std are valid, as if they were declared as global varibales. Then the above statement can be written as follows:
cout << "i didn't pass the cet four" << "ma mai pi";