#include <iostream.h>

#include <stdlib.h>

#include <iomanip.h>

#include <stdio.h>

/*************************************************/

class kolejka {

private:

int tab;

kolejka *next;

public:

kolejka();

// void czysc();

void wstaw(int dane);

void usun();

void wyswietl();

bool pusty();

void Put(char *a);

int glowa();

};

/*************************************************/

kolejka *head=NULL;

kolejka *tail=NULL;

/*************************************************/

bool kolejka::pusty()

{

return head == NULL;

}

/************************************************/

int kolejka::glowa(){

kolejka *tmp = new kolejka;

tmp=head;

return tmp->tab;

}

/**************************************************/

kolejka::kolejka()

{

this->next=NULL;

}

/*************************************************/

void kolejka::wstaw(int dane)

{

kolejka *tmp= new kolejka;

tmp->tab=dane;

if(head==NULL) tail=head=tmp;

else {

tail->next=tmp;

tail=tmp;

}

}

/*************************************************/

void kolejka::usun()

{

if(pusty()) cout <<" Kolejka jest pusta";

else {

kolejka *tmp=head;

head=head->next;

delete tmp;

}

}

/*************************************************/

void kolejka::wyswietl()

{

kolejka *tmp=head;

while(tmp)

{

cout << "| " << setw(20) << tmp->tab <<" |"<< endl;

tmp=tmp->next;

// if(tmp) cout << tmp;

}

}

/************************************************* /

int main()

{

kolejka A;

A.wstaw(1);

A.wstaw(2);

A.wstaw(3);

A.wstaw(4);

A.wstaw(5);

A.wstaw(6);

A.wstaw(7);

A.wstaw(8);

A.wstaw(9);

char a;

int t;

cout << endl;

cout << " MENU : \n '+ obiekt' wstawia obiekt na stos\n '-' usuwa obiekt ze stosu\n '\' KONIEC\n";

A.wyswietl();

while((a=cin.get())!=92)

{

system("cls");

switch(a)

{

case 43: { cin >> t;

A.wstaw(t); break;}

case 45: { A.usun(); break;}

}

A.wyswietl();

}

system("PAUSE");

return 0;

}

*/