Hi All,
I am new to the c++ language and I am reading the book Jumping_into c++. In the Practice problems for chapter 5, Loops the first assignment states to write a program that prints out the entire lyrics to a full rendition of "99 Bottles of Beer". Which I did and it executes perfectly when I build and run the this code:
Code:
//Write a program that prints out the entire lyrics
//to a full rendition of "99 Bottles of Beer"
#include <iostream>
using namespace std;
int main()
{
int x;
for (x = 99; x > 0; x --)
{
cout << x << " " << "bottles of beer on the wall, ";
cout << x << " " << "bottles of beer.\n";
cout << "" << "Take one down, pass it around, ";
cout << --X << " bottles of beer on the wall...," << endl;
cout << "" << "If one of those bottles should happen to fall,\n" << endl;
}
}
But when I tweak the code and change this line to:
Code:
cout << X-- << " bottles of beer on the wall...," << endl;
The program does not not execute correctly.
Why is that?
Thanks in advance.