What is the relationship between #include<iostream> and using namespace std ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

What is the relationship between #include<iostream> and using namespace std ?

12th Mar 2017, 11:19 PM
AZTECCO
AZTECCO - avatar
4 Answers
+ 9
#include<iostream> is a header, it allows you to use the default library, iostream. namespace std allows you to call iostream w/o using the keyword 'std' all the time.
12th Mar 2017, 11:29 PM
Wen Qin
Wen Qin - avatar
+ 7
try removing "using namespace std" in your codes. run it. Then after that, add "std::" in front of your cout and cin, then you get what I meant.
12th Mar 2017, 11:48 PM
Wen Qin
Wen Qin - avatar
+ 4
Thank you Wen Qin. but i dont really understand how or when i call iostream using the keyword std, i only used cin and cout..
12th Mar 2017, 11:38 PM
AZTECCO
AZTECCO - avatar
+ 4
very well! thanks so much!
13th Mar 2017, 8:02 AM
AZTECCO
AZTECCO - avatar