Suppose you had all in one file:
Code:
//declarations - go into headers
void option1();
void option2();
int main()
{
option1();
option2();
}
//implementations may go into a separate cpp file
void option1()
{
//implementation
}
void option2()
{
//implementation
}
A typical header might look like this:
Code:
//options.h
//inclusion guards
#ifndef OPTIONS_H
#define OPTIONS_H
void option1();
void option2();
#endif
An implementation file which needs to know about these functions (to implement or use them), includes the header
Code:
#include "header.h"
Each cpp file needs to be compiled and linked (easily achieved if they all belong to the project).