/*************************************************/ // beer.cpp // R. A. Hillyard // Last Modified: 02/15/2001 // // This program prints all verses of that silly camp song about // all those 'bottles of beer on the wall.' The initial number // of bottles (up to maxBottles) is supplied by the user. /*************************************************/ #include <iostream> using namespace std; //introduces namespace std const int MaxBottles = 25; int main() { int numBottles; cout << "How many bottles of beer ? " ; cin >> numBottles; if(numBottles > MaxBottles) cout << "Too many bottles !!\n"; else { int k = numBottles; while(k >= 1) { cout << k << " bottles of beer on the wall\n"; cout << k << " bottles of beer\n"; cout << "if one of those bottles should happen to fall\n"; cout << k - 1 << " bottles of beer on the wall\n\n"; k--; }// end while }//end else return 0; }