|
-
Sep 19th, 2000, 10:46 PM
#1
What is a header exactly? you knwo the thing that has to be included with C++ program if you want to do some certain stuff... like ---> <iostream.h> <--- is it a c++ function? or is it a class?
Thanks.
-
Sep 20th, 2000, 12:06 AM
#2
A header file just contains pre-written code. The header file "iostream.h" contains the "cout" function. "string.h" contains "strlen()", and so on...
-
Sep 20th, 2000, 12:46 AM
#3
OOok thanks.
-
Sep 20th, 2000, 12:56 PM
#4
Monday Morning Lunatic
Actually, headers contain definitions, rather than actual code. You then include the header and link with the library, which contains the actual code. The header is just there for the compiler's benefit so it knows what you're doing.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 20th, 2000, 01:06 PM
#5
Frenzied Member
You could make your own header file called mymaths.h that could include functions for adding and subtracting 2 numbers . Like:
int Add(int nNumber1, int nNumber2)
{
return nNumber1 + nNumber2;
}
Then for a console app you could put:
#include "mymaths.h"
#include "iostream.h"
void main()
{
char cPause;
int nAnswer;
nAnswer = Add(34,65);
cout << nAnswer;
cin >> cPause;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|