Re: cout
<worlman385@yahoo.com> wrote:
why when I use cout, I must put - using std::cout;
#include <iostream>
using std::cout;
You need to do it in order to introduce `std::cout' name in the
current scope (global scope in your case). All names in C++
standard library are within `std' namespace. You have following
options:
1. Put "using std;" directive in the beginning of CPP file, so all
standard names become visible.
2. Use fully qualified names all the time, i.e. with `std'
namespace: `std::cout', `std::vector', `std::list', etc.
3. Bring desired standard name into current scope individually:
"using std::cout;", "using std::vector;", etc.
if i look at iostream, it seem cout is defined in iostream -
__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 ostream cout;
I also see
_STD_BEGIN
_STD_END
are those label in C++?
No, those are macros. Press F12 while you have keybord caret on
the token to see how it is defined. Names with leading
underscore(s) suggest that they belong to implementation (i.e.,
author of standard library), so the library can use such names for
its own purposes. As a side note, for the same reason you should
abstain of using such names, otherwise you may clash with the
standard names occasionally.
Alex