using, namespace, and std

The next line, using namespace std;, will be present in nearly all of our programs. It tells the compiler to treat the names in the standard library, a very important part of the C++ language definition, as though we had defined them in the current program. These names from the standard library include string, which is why we need using namespace std; here. I'll go into this in much more detail later, but in the meantime, here's a little information about using, namespace, and std.

A namespace is a collection of identifiers (variable names and some other types of names that we haven't discussed yet) that all belong to a “family” of sorts. To refer to a specific identifier that belongs to a namespace, you can prefix the ...

Get C++: A Dialog Programming with the C++ Standard Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.