- #1
0131313131313
- 6
- 0
So, my teacher comes to the lecture, writes the notes on the board... and then says: "from now on this part is intuitive"...
he means this part: (myFront != (myBack + 1) % max)
of the following (C++) code:-
I don't understand it, can anyone explain it please? I don`t understand the relationship between finding whether a queue is full or not, and this line of code: (myFront != (myBack + 1) % max)
he means this part: (myFront != (myBack + 1) % max)
of the following (C++) code:-
Code:
void Queue::addQ (int x)
{
if (myFront != (myBack + 1) % max)
{
...
...
}
else
cout << "Queue is full"
I don't understand it, can anyone explain it please? I don`t understand the relationship between finding whether a queue is full or not, and this line of code: (myFront != (myBack + 1) % max)