You can put the whole lot in a header file.
If it's a regular class (not a bunch of templates), it's more usual to separate them out.
Code:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
// This is myclass.h
#ifndef MYCLASS_INCLUDED_H
#define MYCLASS_INCLUDED_H
class myClass {
private:
int foo;
public:
myClass() : foo(42) {} // an inline implementation
int getFoo(); // an implemetation elsewhere
};
#endif //MYCLASS_INCLUDED_H
// This is myclass.cpp
#include "myclass.h"
int myClass::getFoo() {
return foo;
}
// This is whoever needs to use myClass
#include "myclass.h"
int main ( ) {
myClass obj;
std::cout << "Answer=" << obj.getFoo() << "\n";
}
It doesn't have to be a class.
Any group of similar functions could be separated out into a header file and an implementation file.