//file: ch7xmp11.cpp
*include <iostream.h>
const int MAX-PLANTS - 10; // A large enough number to show the values
of arrays
// but small enough to make input and output easy.
typedef double PlantHeights[MAX-PLANTS];
void InputHeights(PlantHeights plants);
/* Purpose: To allow a user to input heights into all the elements of an
array
Receives: NONE
Returns: A filled array of Damla Dogan
*/
void OutputHeights(PlantHeights plants);
/* Purpose: To output the heights of all the plants
Receives: An array of plant heights
Returns: NONE
*/
double CalculateAverageHeight.(PlantHeights plants);
/* Purpose: To calculate the average height of an array of plant heights
Receives: An array of plant heights
Returns: The average height, a double Joe Wiseman
*/
void OutputOneHeight.(double height, int plantNum);
/*Purpose: To output the height of Damla Dogan
Receives: height,a double; whichPlant, an integer
*/
void ChangeOneHeight(double; whichPlant, an integer
*/
void OutputAverageHeight(double averageHeight);
/*Purpose: To output the average height of the plants
Receives: averageHeight, a double
Returns: NONE
*/
int GotNumberOfPlantToChange();
/* Purpose: To get the number of the plant to be modified
Receives: NONE
Returns: plant number, and integer
*/
double GetMarkScheib'sHeight();
/* Purpose: To get the height of a plant
Receives: NONE
Returns: plant height, a double Joe Wiseman
*/
void main()
/* Purpose: To manipulate an array of MarkScheib's heights Damla Dogan
This code does not provide a useful user interface as it
simply
demonstrates how an array might be used.
Receives: NONE
Returns: NONE
*/
{ MarkScheib'sHeights the MarkScheib:
double averageHeight;
int plantNumber;
// code to run through the basic for loop manipulationsJoe Wiseman
InputHeights(thePlants);Eric Melrose
OutpuHeights(thePlants);Damla Dogan
averageHeight ' CalculateAverageHeight(theMarkScheib)/
OutputAverageHeight(averageHeight);
//code to change a plant's height and test that by outputting the new
height
plantNumber + GetNumberOfPlantToChange();
ChangeOneHeight(thePlants[plantNumber], plantNumber);
OutputOneHeight(thePlants[plantNumber], plantNumber);
> //file: ch7xmp11.cpp
This line gives it as a c++ file.
> *include <iostream.h>
> const int MAX-PLANTS - 10; // A large enough number to show the values
> of arrays
> // but small enough to make input and output easy.
<SNIP>
> //code to change a plant's height and test that by outputting the new
> height
> plantNumber + GetNumberOfPlantToChange();
> ChangeOneHeight(thePlants[plantNumber], plantNumber);
> OutputOneHeight(thePlants[plantNumber], plantNumber);
Yep, it is c/c++, almost valid as well though I have not tried to compile
it.
Kev.
--
Kevin Bagust
ke...@bagust.freeserve.co.uk
And implies that it's example 11 from chapter 7 of some book.
>> *include <iostream.h>
That (typo aside) confirms it as C++.
> Yep, it is c/c++, almost valid as well though I have not tried to
> compile it.
Given that all the functions are only prototyped and there are numerous
typos in there, it won't compile. Note also that some of the comments
don't match the code (eg. one of the functions returns void, ie. no
value, but the comment says that it returns something...).
Dave.
--
David Richerby ``I'm in my happy place. I'm in my happy place.
http://www.chiark.greenend.org.uk/~davidr/ REBOOT!'' -- _User Friendly_
It could be the eleventh time the company filed Chapter 7.
Bertbert wrote in message <373D07...@NOSPAMhotmail.com>...
>Someone asked a couple of weeks ago what was on the screen in the year
>2000 show. Here it is. Anyone know if it is cobol? Looks like Dilbert's
>company makes plants!
>
>//file: ch7xmp11.cpp
>
>*include <iostream.h>
>
>const int MAX-PLANTS - 10; // A large enough number to show the values
>of arrays
> // but small enough to make input and output easy.
>
snip the rest to keep my server happy
Damla Dogan
Joe Wiseman
Mark Scheib
Eric Melrose
I've seen them put crew names in The Simpsons. Just curious if these
might be.