What are header files?
What are header files?
Files you include in your program. They have functions and stuff....
Code:#include <iostream> //<-- Thats a header file int main() { std::cout << "Llammas smell pretty"; return 0; }
>What are header files?
Thingies (technical term) that declare names so that you can use them and compile the code before linking with the corresponding library. Without header files you would need to declare everything manually or you would get compilation errors. Technically (which is why I used the technical term ) headers need not be files, so calling them header files is somewhat of a misnomer.
My best code is written with the delete key.
by the way, vicious,, why u have std:: before the cout. What does that do?
instead of goingOriginally Posted by Sridar
at the start, you can just go std:: in front of cout, cin, etcCode:using namespace std;
DW
heh...i never use std namespace or std:: and I have no trouble. in fact, when i do using namespace std;, i get an error. im using Borland 5.02
Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.
Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.
I"m using Borland 6, and I'm the same way. I can use non std, std::, using namespace std;
All of them work just fine. I don't do console apps very offten, so I don't know too much on this subject. I would assume that Borland includes it some where already?
DW
>im using Borland 5.02
Get a newer compiler.
My best code is written with the delete key.
There are about 50 headers in standard C++. You include them if you want to use the particular functions / functionality of a header.
If you need to calculate a square root, you can use sqrt() if you #include <cmath>. If you need to work with time and dates, then #include <ctime>.
Your compiler will probably have additional headers in addition to those required by the language standard. For example, <windows>.
You can write your own header files (and an associated cpp file). This can be done to better organize a large program, or to make it easier to re-use your functions in another program.
I used to work with Borland. Only I was unfortunate enough to be stuck with version 3.1 which was 16-bit only. When I started hitting the memory limits it was either learn protected mode or switch to a new compiler that did the job for me. Guess which I choose.
You might want to eventually switch to a different compiler because Borland is a bit on the proprietary side. Namely they're known to have commands specific to their compiler only which makes porting a headache.
Ah header files. So much fun. I found I can store classes along with their code in a header file and not worry about having a separate file for the code. That is probably bad programming practice so I'll probably stop doing it... eventually.
Last edited by Frobozz; 09-07-2004 at 02:44 PM.