18.5) Exercise 31
Open the provided file dataset.hpp in your text editor. This defines a class called Dataset
, which represents a set of double values read from a file. Dataset
is intended to provided equivalent functionality to the statistical analysis functions implemented in Exercise 23.
Next, create an implementation file dataset.cpp containing implementations of the methods specified in dataset.hpp. Make sure that you have an include directive for dataset.hpp in your implementation file. Use g++ -c to check that the implementation file compiles.
Finally, write a program that uses the Dataset
class. Your program should:
- Obtain an input filename as a command line argument
- Create an
ifstream
object for this file - Use the
ifstream
object to create aDataset
object - Call methods on the
Dataset
object in order to compute statistics of the data