why do write namespace std while initiating any program
Using namespace std
see the default libarary of c++ has many default functions in it and there are multiple definition of function under different namespaces( means different library)
so std is one such namespace which have cout cin and more commonly used in the program
of instead of creating a confusion from which namespace u are refering the persently called functionanlity u need to mention
std::cout <<“HELLO”;
so in order to avoid using std::____ ( ____ some operator, or predefined syntax) we use using namespace std ; at the start
so that the compiler understands that we are using these syntax and it has to derive its meaning from this namespace and not from any other
The using namespace statement just means that in the scope it is present, make all the things under the std namespace available without having to prefix std:: before each of them.
read more about it here
https://www.tutorialspoint.com/What-does-using-namespace-std-mean-in-Cplusplus
we have to use namespace because it tells the computer that what to do with a specific function or variable.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.