Please send questions to
st10@humboldt.edu .
#include <iostream>
using namespace std;
// Contract: print2 : int& -> void
// Purpose: prints the numBottles'th verse of
// "99 Bottles of Beer on the Wall"
// to the screen, and REDUCES numBottle's
// corresponding argument by 1.
//
// Examples: if variable val has the value 89,
// print2(val) 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!
// ... and val should be changed to 88.
//
// by: Sharon M. Tuttle
// last modified: 10-28-03
void print2(int& numBottles)
{
// 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;
// OK now --- I've made it pass-by-reference,
// and WARNED/told the user in the opening
// comment block;
numBottles = numBottles - 1;
cout << numBottles
<< " bottles of beer on the wall." << endl;
}