0
Why we use std::
suppose after written int main () some times we are using std::<<"i <10",i++; in this case why we are using std:: I am not understand
2 ответов
0
i am no good at english.it is a standara norm,if you use cout or cin,you should write std,and we of declare std in the program begain to simplify the program
0
The std:: indicates that some names such as cout, cin and endl are part of the *namespace* std, which is defined by the standard library. The <iostream> header is part of the standard library; for this reason, we refer to cout as std::cout, which is the standard output stream.
Now, the namespace is primarily used to distinguish potential names that are essentially the same. For instance, in a program that uses library A and library B, library A contains a name X, and library B also happens to contain a name X. To refer to X from library A, we want to use A::X to distinguish it from X from library B, which is referred to as B::X.