OK. I couldn't wait for lunch. I actually had 2 issues when beer was at 2 and at 1. Is this coded correctly or should I have done it differently?
Thanks,
Kranky
Code:
#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-- )
{
if ( i == 2)
{
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
}
else if ( i == 1 )
{
cout << i << " bottle of beer on the wall, " << i << " bottle of beer.\n";
cout << "Take it down, pass it around, no more bottles of beer on the wall.\n";
cout << "\n"; // for better format on the output
}
else
{
cout << i << " bottles of beer on the wall, " << i << " bottles of beer.\n";
cout << "Take one down, pass it around, " << i - 1 << " bottles of beer on the wall.\n";
cout << "\n"; // for better format on the output
}
}
}
Edit: I realize this stuff is so basic for you guys. Thanks for taking the time and helping me. I look forward to passing it on when I know more.