SOURCE FILE: eg7.5.cpp
//DISPLAY 7.5 Outline of the Graph Program
//Reads data and displays a bar graph showing productivity for each plant.
#include <iostream>
const int NUMBER_OF_PLANTS = 4;
void input_data(int a[], int last_plant_number);
//Precondition: last_plant_number is the declared size of the array a.
//Postcondition: For plant_number = 1 through last_plant_number:
//a[plant_number-1] equals the total production for plant number plant_number.
void scale(int a[], int size);
//Precondition: a[0] through a[size-1] each has a nonnegative value.
//Postcondition: a[i] has been changed to the number of 1000s (rounded to
//an integer) that were originally in a[i], for all i such that 0 <= i <= size-1.
void graph(const int asterisk_count[], int last_plant_number);
//Precondition: asterisk_count[0] through asterisk_count[last_plant_number-1]
//have nonnegative values.
//Postcondition: A bar graph has been displayed saying that plant
//number N has produced asterisk_count[N-1] 1000s of units, for each N such that
//1 <= N <= last_plant_number
int main( )
{
using namespace std;
int production[NUMBER_OF_PLANTS];
cout << "This program displays a graph showing\n"
<< "production for each plant in the company.\n";
input_data(production, NUMBER_OF_PLANTS);
scale(production, NUMBER_OF_PLANTS);
graph(production, NUMBER_OF_PLANTS);
return 0;
}