Is it necessary to use std::cout or just cout | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it necessary to use std::cout or just cout

21st Sep 2020, 8:25 AM
Isaac
Isaac - avatar
4 Answers
+ 3
If you declare the namespace std Then just write cout else you have to declare std::cout for print Though we use cout most of the time with declaring namespace ,using of std::cout is a good practise. You can see this article: https://www.geeksforgeeks.org/using-namespace-std-considered-bad-practice/
21st Sep 2020, 8:38 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 7
Be prepared to go down the rabbit hole on why (or why isn't) "using namespace std;" a bad practice, if that is what you are asking. Otherwise, it is as 😭😥 has answered. https://www.sololearn.com/Discuss/294730/?ref=app https://www.sololearn.com/Discuss/392399/?ref=app
21st Sep 2020, 8:35 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
Once define using namespace std ; in beginning then you dont need to write std again and again with cin and cout
21st Sep 2020, 8:31 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
21st Sep 2020, 8:33 AM
A S Raghuvanshi
A S Raghuvanshi - avatar