Header files (.h) provide information that will be required in multiple files or in a module. Class declarations, function prototypes and enumerations typically go in header files.
void print_factorial(int n);
int factorial(int n);
Code files (.cpp) contains the implementation that only needs to be known in one file. Function bodies and internal variables are implmented in .cpp files.