Why namespace std is used...?? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren

Why namespace std is used...??

25th Oct 2018, 11:43 AM
aryan verma
aryan verma - avatar
4 Antworten
+ 4
If you are reference by the line using namespace std; is really simple look this example below std::cout << "Why use std" << std::endl; This is what you need to type to print without namespace std. With namespace std. this happens cout << "Why use namepace std" << endl; In most simple and non formal way it's like you are giving a nickname to make code more readeble.
25th Oct 2018, 12:04 PM
Anya - avatar
Can you show code where it is used? Or explain your question more detailed please. By the way, you can lear more about namespaces.
25th Oct 2018, 11:52 AM
So you can avoid this... std::cout std::cin std::string Lots more,you could omit it if you want..
25th Oct 2018, 12:00 PM
Mensch - avatar
easier for students to keep up with a lesson taught. but it is considered a bad practice using it for bigger programs. btw, 'using namespace' is just a way to shorten your code.
25th Oct 2018, 12:01 PM
Kuyondo - avatar