So far am I correct? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

So far am I correct?

Maybe a stupid ? but I want to make sure I understand before I go any further. #include <iostream> gets basic C++ libraries that you can use like cout; endl and not sure what others. using namespace std; is used for name recognition; example will be like if you have two Heather's in your class and you need to define each one.

18th Jun 2017, 5:22 PM
Thomas Mccaffery
Thomas Mccaffery - avatar
7 Answers
+ 4
The first one is nearly correct, it is basic C++ libraries for input and output using name space std; allow you not to use std each time you use something in the namespace For example : std::cout become cout
18th Jun 2017, 5:25 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 2
Like @Baptise said, You are right about iostream. Namespace is not used like that, it is used to include libraries like the std ( Standard library ). Here is a refference for more information. http://www.cplusplus.com/doc/tutorial/program_structure/
18th Jun 2017, 6:46 PM
Manual
Manual - avatar
+ 1
Even I had the same doubt still not clear
18th Jun 2017, 9:25 PM
Adithya Pai
Adithya Pai - avatar
+ 1
A post and code from today showed that, @Thomas' second statement has truth to it. Here is the thread https://www.sololearn.com/discuss/475134/?ref=app
18th Jun 2017, 11:20 PM
Manual
Manual - avatar
0
I guess so BTW I can't assure you I am weak in c++
18th Jun 2017, 5:24 PM
_Retr0/-
_Retr0/- - avatar
0
as the name suggests iostream (input output stream) allows you to take an input, process it and return an output in c++ so, yes you are right about the first one but you don't have to be sure about the second.. just take it as a shortcut to writing your code.. instead of writing std:: every time you use an iostream function I a pain... so writing that line allows you to use those functions without having to write std:: every time.. you will learn more about this when you startle learning about classes and headers. till then... knowing this Is enough! hope this helps peace✌
18th Jun 2017, 10:38 PM
Abdur Raafi
Abdur Raafi - avatar
18th Jun 2017, 10:49 PM
Abdur Raafi
Abdur Raafi - avatar