Don't. "using namespace foo;" is the using directive. It has the same effect as the library having no namespace at all. Standard library has not been put into a namespace without a good reason.
There is using declaration too. "using std::cout; using std::endl;" That brings only those two names into scope.
However, in the example code it is simpler to just prefix the names with std:: where they are used.