Can we execute a program without using namespace std and return? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

Can we execute a program without using namespace std and return?

13th Jul 2017, 10:01 AM
Ani Roh
Ani Roh - avatar
4 Respuestas
+ 3
Of course ! If you remove "using namespace std;" you'll just have to put std:: before objects contained in it like that : std::cout<<"Hello world!"<<std::endl; if you omit the return 0 statement, it will just be put by default so yes you can forgot to write it but it will still be there in the end.
13th Jul 2017, 10:07 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
@Baptiste Exactly. Moreover, some programmers say that using std:: is better than "using namespace std. Hope im not wrong...
13th Jul 2017, 10:10 AM
Ledio Deda
Ledio Deda - avatar
+ 1
Yes @Ledio, this is to avoid overriding that can occur (bringing error as it is not permitted in C++ if I am not wrong) because of two objects with the same name in two different namespace.
13th Jul 2017, 10:11 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
Std::cout<< Std::cin>>
30th Nov 2021, 8:44 PM
mohand
mohand - avatar