Quick Question

At the beginning of some codes that i see in the book that I am reading, sometimes, this comes up:

#include <iostream>

This was explained once, but i didn't really understand what its supposed to do. Also, sometimes this comes up in the beginning of the code:

#include <string>

Anyone could tell me what they are supposed to do?


#include <someFile> is an instruction to the pre-processor to find the file named someFile and copy it completely, exactly, into that spot.

So, #include <iostream> is an instruction to the pre-processor to find the file named iostream and copy it completely, exactly, into that spot. Likewise for the file named string.


In C++, these files contain necessary declarations and other code so that you can make use of functions and classes to do with input/output (in the case of iostream) and string objects (in the case of string).
One of our forum members Disch has written an article about this
subject - here:
http://www.cplusplus.com/forum/articles/10627/
Thank you
Topic archived. No new replies allowed.