+ 2

What is "using namespace std" is doing?

what's is that doing in the program?

28th Sep 2016, 2:01 PM
Cesar Ricardo
Cesar Ricardo - avatar
2 ответов
+ 6
it's kind of a shortcut. When you use some functions like "cout" or "cin" or when you declare a variable using "int, double, string ...." you should put "std::" in front of them. Like "std::cout" or "std::cin". That namespace is helping you to write faster. Or at least this is just one role.
28th Sep 2016, 2:47 PM
Andrei Cîrpici
Andrei Cîrpici - avatar
+ 2
Things like cout, cin, string, etc are located in what's called a namespace (consider it a group). Their namespace is called std. Usually you access these operators by writing std::cout, std::string, etc. With "using namespace std;" you can use them without having to write std:: everytime.
28th Sep 2016, 7:21 PM
ABC
ABC - avatar