#include
# define Max 9
The class queue {
Public:
The queue () {
The front=rear;
};
Bool empty () {
If (front==rear) return true;
return false;
};
Bool full () {
If (front %==Max - 1 rear) return true;
return false;
};
Int get_front (int & amp; X) {
If (empty ()) return 0;
X=data [Max (front + 1) %];
return 1;
};
Int append (int x) {
If (full ()) return 0;
Rear=Max (rear + 1) %;
Data (rear);
return 1;
};
Int serve () {
If (empty ()) return 0;
The front=Max (front + 1) %;
return 1;
};
Private:
Int the front and rear;
The int data (Max);
};
Void main () {
Int x, s1, s2, m, j, I;
X=1;
The queue q;
Cout
For (I=2; i<=8; I++) {
S1=0;
for(j=1; J<=I - 1; J++) {
Q.g et_front (s2);
Q.s erve ();
M=s1 + s2;
Cout
S1=s2;
}
Cout<1
}
}