Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Element{
- string wartosc;
- int priorytet;
- };
- class FIFO{
- int max=30;
- Element tab[max];
- int glowa;
- int ogon;
- FIFO(){
- glowa=0;
- ogon=0;
- }
- bool attach(Element element){
- if(empty()){
- tab[ogon]=element;
- ogon=(ogon+1)%max;
- return true;
- }
- else if((ogon+1)%max==glowa)
- return false;
- else{
- ogon=(ogon+1)%max;
- tab[ogon]=element;
- return true;
- }
- }
- bool detach(){
- if(empty()){
- return false;
- }
- else if((glowa+1)%max==ogon){
- glowa++;
- return false;
- }
- else{
- }
- }
- bool empty(){
- if(glowa==ogon)
- return true;
- }
- Element front(){
- if(empty())
- return tab[glowa];
- }
- };
- class LIFO{
- int max=30;
- int szczyt;
- Element stos[max];
- LIFO(){
- szczyt=0;
- }
- bool empty(){};
- bool push(el){};
- bool pop(){};
- Element pop(){};
- };
- int main(){
- cout << "Hello World!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement