I had the hardest time understanding this when I first started programming.
Let me give you a simple example...
Lets say this file is called Functions.h
Code:
#ifndef _FUNCTIONS_H
#define _FUNCTIONS_H
#include <iostream>
void Func1();
void Func2();
#endif
Now in that file you have declared prototypes for your functions.
the #ifndef #define is what keeps the functions from being declared more than once. Its saying "Hey, if this file was already declared... nevermind!"
Here is a file called Functions.cpp
Code:
#include "Functions.h"
void Func1()
{
//+---Code for the function---+
}
void Func2()
{
std::cout << "Hello";
}
Now that file defines the functions.
and here is main.cpp
Code:
//+--"Import" your functions---+
#include "Functions.h"
int main()
{
Func2(); //+---This will print "Hello" to the screen---+
return 0;
}
If theres anything about that you dont understand let me know