Kocyk

queuenafide

May 6th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. using namespace std;
  4.  
  5. struct el_FIFO{
  6.  int x;
  7.  struct el_FIFO* nast;
  8. };
  9. struct FIFO
  10. {
  11.     struct el_FIFO* poczatek;
  12.     struct el_FIFO* koniec;
  13. };
  14. struct FIFO * attach(struct FIFO *k,int el)
  15. {
  16.     struct el_FIFO * new_el= new struct el_FIFO;
  17.     new_el-> x=el;
  18.     new_el->nast=NULL;
  19.     if(k -> poczatek==NULL)
  20.     {
  21.         k->poczatek=new_el;
  22.         k->koniec=new_el;
  23.     }
  24.     else
  25.     {
  26.         k->koniec->nast=new_el;
  27.         k->koniec=new_el;
  28.        
  29.     }
  30.     return k;  
  31.  
  32. }
  33.  
  34. /*struct el_FIFO* push(struct el_FIFO *top, int el){
  35. //dodanie elementu na stos
  36. // wartość elementu dodawanego jest w zmiennej el,
  37. //wskaźnik na wierzchołek stosu jest w zmiennej top
  38. //wynikiem funkcji jest wskaźnik na nowy wierzchołek stosu
  39.  struct el_FIFO * new_el_FIFO=(struct el_FIFO*)malloc(sizeof(struct el_FIFO));
  40.  new_el_FIFO->x=el;
  41.  new_el_FIFO->nast=top;
  42.  return new_el_FIFO;
  43. }*/
  44.  
  45. int main()
  46. {
  47.    
  48. }
Add Comment
Please, Sign In to add comment