8. QUEUE
17 May 2020 | STL Programming Practice_1
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int Queue[1000], backID, frontID;
void push(int x)
{
Queue[++backID] = x;
}
int Front()
{
return Queue[frontID];
}
void pop()
{
Queue[frontID] = 0;
++frontID;
}
int main()
{
backID = -1;
frontID = 0;
push(5);
push(6);
push(7);
cout<<Front();
pop();
cout<<Front();
return 0;
}
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int Queue[1000], backID, frontID;
void push(int x)
{
Queue[++backID] = x;
}
int Front()
{
return Queue[frontID];
}
void pop()
{
Queue[frontID] = 0;
++frontID;
}
int main()
{
backID = -1;
frontID = 0;
push(5);
push(6);
push(7);
cout<<Front();
pop();
cout<<Front();
return 0;
}
Comments