0
What is the difference between #include<iostream> and using namespace std??
2 Antworten
+ 4
iostream is a library that have function like (cin cout int float...)
Using namespace std is a shortcut if you want to make your code more clean.
You can not make a code without iostream (or without any library) but you can without using namespace std simply by adding before every single line of function std::
Example (without using namespace std)
std :: cout <<"without using namespace std";
std :: cin>>name;
If you want more explanation let me know!
+ 2
Check this quora question.
https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.quora.com/Whats-the-difference-between-include-iostream-and-using-namespace-std-in-C%2B%2B%23:~:text%3DIOstream%2520is%2520a%2520library%2520package,keyboard%2520and%2520ostream%2520with%2520monitor.%26text%3DNamespace%2520is%2520a%2520region%2520that,function%252C%2520variable%2520to%2520avoid%2520collision.&ved=2ahUKEwiV7IGB7dPxAhV6umMGHQFpCsEQFjABegQIBBAF&usg=AOvVaw13o3ZIfB-th2SWq22dbsTk&cshid=1625760345929