This lab will help you practice with 2D vectors.
Write a program to solve problem 14 from page 565 of chapter 10. Don't forget to adjust for the author's poor style (int, return's, commenting, etc.).
Alter the input so that you can fill in only the number of values in the production vector as you need. (That way when that new plant comes online next month, we won't have to re-compile with a new constant. I hear another is scheduled for construction by the end of the year, too!)
You can label the graph something like this:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Plant 1 2 3 4
(That'd be the one from the book sample run...)
// Fills in the vector from index min to index max (max not included) // with the specified value. void fill_vector(vector<_TYPE_> vec, _TYPE_ with, vector<_TYPE_>::size_type max, vector<_TYPE_>::size_type min = 0);Would that help you draw the initial graph?
(Could this also help with the initialization discussed above?)
This assignment is (Level 4).
Add (Level 1.5) to label the graph columns horizontally under the graph. Try to center the column above the label. It might look something like this:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Plant 1 Plant 2 Plant 3 Plant 4
Add (Level 2.5) to label the graph columns vertically under the graph -- one letter per line. This might look like:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ---------------------- P P P P l l l l a a a a n n n n t t t t 1 2 3 4
(You can do both this and the previous option by letting the user choose the labeling style with a menu. I'll even throw in another (Level 0.5) for the trouble to make the menu decent.)