using std::cout; // program uses coutusing std::cin; // program uses cinusing std::endl; // program uses endl
are using declarations that eliminate the need to repeat the
std:: prefix as we did in earlier programs. We can now write
cout instead of
cin instead of
endl instead of
std::endl, respectively, in the remainder of the program.
In place of lines 6–8, many programmers prefer to provide the using directive
using namespace std;
which enables a program to use all the names in any standard C++ header (such as
<iostream>) that a program might include. From this point forward in the book, we’ll use the preceding directive in our programs. In Chapter 21, Other ...