0
what does using namespace std do? elaborate each and everything
7 Respostas
+ 2
"using namespace std;" allows you to use the standard namespace without explicitly saying so:
#include <iostream>
using namespace std;
int main()
{
cout << endl;
return 0;
}
is similar to:
#include <iostream>
int main()
{
std::cout << std::endl;
return 0;
}
+ 1
Like i said. Im literally half an hour into playing around with everything. Thats just the conclusion I came to. Im sticking around to find the answer out though.
+ 1
Well Quantum Chromodynamics, thanks, but what is the standard namespace?
+ 1
Sorry, I don't know much. "std" includes operations such as "cout", "cin" and "endl". If namespaces are not declared as being used after the preprocessor directives, you can use the name of the namespace followed by a "::" to access the operation.
For example,
#include <iostream>
using namespace std;
int main()
{
this_thread::sleep_for(chrono::milliseconds(10));
return 0;
}
This would call a function "sleep_for" with namespace "std", "this_thread" and class "chrono".
(I'm not sure if "this_thread" is a namespace or class)
+ 1
I found this link if this is of any use - https://www.quora.com/What-does-using-namespace-std-mean-in-C++
+ 1
using namespace is a standard for naming such as cout ,cin etc with std these are not recognize and generate error
0
thanks to both of you.