HELP HELP HELP !

hi guys,i am very new to this site and most of all im very very very very very new to programming and c++. i started learning it only week ago but reading pages over pages isnt helping much. so hopefully you guys can help. so i just wanna know like
WHAT ARE THESE
#include(iostream, or conio or name space and so on. you might ll say theses are header files or something els but i dont know what that means coz i have seen lot of examples where different types of files are used not iostream or conio or any another file. i dont know what are these files how do i know which file i should use and WHEN AND WHERE should i use it? Please help

iostream is a header. conio.h is a header.

When you #include them, you are telling the compiler to take the contents of those headers and inject it into your program.

Headers are just source code files. They contain a bunch of code that is pre-made for you to use. Which header you want/need to include depends on which code you want to use.

For example, std::cin and std::cout (used for input/output to the console) are both declared in <iostream>. So if you want to use either of them, you must #include <iostream>.

The std::string class, which can be used to keep track of variable length strings, is defined in the <string> header. So if you want to use that class in your code, then you must #include <string>

i dont know what that means coz i have seen lot of examples where different types of files are used not iostream or conio or any another file


Those examples either would not compile, or they did not use anything from those headers.

IE, this program will compile fine without #including anything:

1
2
3
4
int main()
{
    // do nothing
}



However, this program uses cout, so it must #include <iostream>. Without iostream, the compiler doesn't know what 'cout' is supposed to be:

1
2
3
4
5
6
#include <iostream>

int main()
{
    std::cout << "example";
}


i dont know what are these files


They're somewhere on your computer. It depends where you installed them.
Thank you, Thanks for sparing some time for me and explaining all this to me. But as you know im only a beginner. So so far it seems like that these answer are putting more questions in my head than knowledge......lol. So i really hope you (DISCH) or any body else who might ll reply, dont mind if i ask you few more questions or more like clear my doubts with u.

So as you said above,
"Headers are just source code files. They contain a bunch of code that is pre-made for you to use. Which header you want/need to include depends on which code you want to use."

(1)So you saying there are bunch of pre made code files available in the compiler it self, by the way I am using visual studio 2013. And i can choose according to my needs. ?

(2)If Yes, Than how will i or any programmer ll know what pre made codes are available? and They come Under what sort of file or header file name?

or if rephrase my question , Is there any list of these files available ? with names and use?

And are there any kind of standerd files which are used almost in every program.


i Know some of you guys might ll laugh but hey Curiosity Kills The Cat. i just had to ask. Thanks in advance
Every compiler is slightly different, but somewhere in your compiler's directory tree there should be a folder called "include", this is where all the standard files are, including iostream. There are also probably some 3rd-party headers in there as well, such as windows.h

Look at the Reference section on this site. Everything between < > on that page is a standard header that you can #include. You can click the links to see what useful things each header contains.
Last edited on
Topic archived. No new replies allowed.