On chapter 5 problem 1 in Jumping into C++ I need to write a program that prints out all the lyrics to 99 Bottles of Beer on the Wall.
I did it two ways. One with several cout statements and one condensed. Here is the second way:
Is this way of doing it OK formatting? Also, is there a way to convert numbers to text? Example: 99 = Ninety-NineCode:#include <iostream>
using namespace std;
// Write a program that prints out the entire lyrics
// to a full rendition of "99 bottles of bear".
int main()
{
for ( int i = 99; i > 0; i-- )
{
cout << i << " bottles of beer on the wall, " << i << " bottles of beer.\n";
cout << "Take one down, pass it around, " << i - 1 << " bottle of beer on the wall.\n";
cout << "\n"; // for better format on the output
}
}
Thanks,
Kranky