Build a simple class that implements a generic list (a list that can hold items of any given type (all items must be of the same type though)). The list must be able to grow, that is, it must be possible to add items to the list.
Basically only one
method, "add", is needed. Something like
129.24 24.8 4.847 88.6 33.745 7.78 30.39 99.811 6.723 -1.33 96.3 2.23Create a Main function that reads such a table line by line from the standard input into a
genlist<std::vector<double>>
and then
prints the numbers in the form of a neat table into standard output in
exponential format. Something like
(Extra) Implement "void remove(int i)
" method that
removes element number "i".
(Extra) Improve the speed of the "add" method by increasing the capacity of the data-array not by one element, but instead by doubling it. That should decrease the amount of array copying significantly for the price of increased memory usage.
(Extra) Implement generic list using a chain of nodes.