For what purpose" using namespace std " is used? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

For what purpose" using namespace std " is used?

21st Mar 2017, 9:33 AM
Arjit Ahlawat
Arjit Ahlawat - avatar
4 Answers
+ 1
namespace is similar to the workspace in real time... you can use your tools without any objection or external commands ... but to use tools from other workspace ...you have to get their permission... similarly in cpp all the input /output streams and most basic functionalities are given under the namespace "std".it is provided in #include<iostream>. "using" is a keyword which tells the compiler which namespace is being used . if you don't use using namespace std... you should specify the compiler that the functions we use like cout,cin ,etc belong to std std::cin,std::cout...etc. you can even create your own namespaces... like int main(or any other main) specify it as namespace name...where name can be any legit string (or variable name). you can define some functions inside it... and use them with... name::function().... hope this helps...
22nd Mar 2017, 12:42 AM
SANJAY SIDDHARTH C V
SANJAY SIDDHARTH C V - avatar
0
thanks man..but the thing is i use turbo c++ in my pc and there i dont need to use this.why so?
22nd Mar 2017, 4:32 AM
Arjit Ahlawat
Arjit Ahlawat - avatar
0
it depends on the compiler ... turbo c++ is so user-friendly that they have many things implicit...
22nd Mar 2017, 2:16 PM
SANJAY SIDDHARTH C V
SANJAY SIDDHARTH C V - avatar
0
if you want to learn coding in more basic level too...try using codeblocks with mingw compiler (inbuilt with gnu/gcc compiler)
22nd Mar 2017, 2:17 PM
SANJAY SIDDHARTH C V
SANJAY SIDDHARTH C V - avatar