I am a newbie to programming and don't have a clue how to make header files for my fuctions and classes
how do i use the #ifndef statement and the others like it
I am a newbie to programming and don't have a clue how to make header files for my fuctions and classes
how do i use the #ifndef statement and the others like it
the best way to learn programming is by reading books
but i'll try to help you with your question
in a header fileyou define the function(prototype) or the class
like:
void Example(); // function prototype
class Example
{
// define your class here
};
If You've Be Biten By DaRk$nAkE The Only Things You Will See R Bytes
The compiler will only compile code between #ifndef xxx and #endif, if it hasn't encountered #define xxx before.It's sometimes used to stop the same header file being included twice:
#ifndef __STDIO_H
#define __STDIO_H
...
#endif
You can use define to include lines for debugging or not:
#define debug
int x = 5;
#ifdef debug
cout << "x is " << x << endl;
#endif