Please send questions to
st10@humboldt.edu .
#include <iostream>
using namespace std;
// Contract: printBeerVerse : int -> void
// Purpose: prints the numBottles'th verse of
// "99 Bottles of Beer on the Wall"
// to the screen
//
// Examples: printBeerVerse(89) should cause the
// following to be printed to the screen:
// 89 bottles of beer on the wall,
// 89 bottles of beer!
// Take one down, pass it around,
// 88 bottles of beer on the wall!
//
// by: Sharon M. Tuttle
// last modified: 10-28-03
void printBeerVerse(int numBottles)
{
// local variables
int nextNumBottles;
// print the four lines of this verse, starting on a
// new line
cout << endl;
cout << numBottles << " bottles of beer on the wall,"
<< endl;
cout << numBottles << " bottles of beer," << endl;
cout << "take one down, pass it around," << endl;
// notice how I am meeting the class coding standards,
// by NOT changing parameter numBottles, but
// changing a local copy of numBottles, instead
nextNumBottles = numBottles - 1;
cout << nextNumBottles
<< " bottles of beer on the wall." << endl;
}