Finish X.5.8.

Extract helper functions into separate header file.
Make printVector a templated function.
Finish X.5.9.
Finish X.5.10.

Adapt writing of integers such that the integers are separated by
a space, to enable easy reading with the >> operator.
Use constructor for opening file iso open function.