Skip to main content

Re-using Functions In Other Programs


Consider the three functions from the statistical analysis program discussed earlier:

data.cpp:

void read_data(istream& input, vector<double>& data)
{
  ...
}

stats.cpp:

double mean(const vector<double>& data)
{
  ...
}
double stdev(const vector<double>& data)
{
  ...
}

These functions are generally useful – but how do we make them easily available for use in other programs?