What is the function of using namespace std written at the beginning of the file in C++?

##
C++的STL都是定义在std命名空间中的,
using namespace语句的作用是提前声明要引用的命名空间,这样在引用命名
空间中的名称是就不需要加命名空间前缀。
例如,如果不用using namespace std;那么在引用cin的时候,就需要写成std::cin

##

Guess you like

Origin blog.csdn.net/cfk17829572643/article/details/111698570