/*************************************************/ // wine.cpp // R. A. Hillyard // Last Modified: 09/10/2001 // // This program prints all verses of that silly camp song about // all those 'bottles of wine 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 wine ? " ; cin >> numBottles; if(numBottles > MaxBottles) {cout << "Too many bottles !!\n";} else { int count = numBottles; while(count > 0) { cout << count << " bottles of wine on the wall\n"; cout << count << " bottles of wine\n"; cout << "if one of those bottles should happen to fall\n"; cout << count - 1 << " bottles of wine on the wall\n\n"; count--; }// end while }//end else return 0; } /***************Program Output************/ How many bottles of wine ? 4 4 bottles of wine on the wall 4 bottles of wine if one of those bottles should happen to fall 3 bottles of wine on the wall 3 bottles of wine on the wall 3 bottles of wine if one of those bottles should happen to fall 2 bottles of wine on the wall 2 bottles of wine on the wall 2 bottles of wine if one of those bottles should happen to fall 1 bottles of wine on the wall 1 bottles of wine on the wall 1 bottles of wine if one of those bottles should happen to fall 0 bottles of wine on the wall