PDA

Click to See Complete Forum and Search --> : Ruh?


Sep 19th, 2000, 10:46 PM
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
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
:):):):):):):):):):):)

parksie
Sep 20th, 2000, 12:56 PM
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.

PsyVision
Sep 20th, 2000, 01:06 PM
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;
}