Advertisement
F22

Untitled

F22
Jan 22nd, 2014
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. struct SLista
  4. {
  5.     int dane;
  6.     SLista *next;
  7. };
  8.  
  9. int main()
  10. {
  11. SLista *akt, *glowa, *ogon;
  12. int liczba;
  13. akt=NULL;
  14. glowa=NULL;
  15. cout<<"Wprowadz calkowite liczby, 0 konczy wpisywanie"<<endl;
  16. cin>>liczba;
  17. while(liczba!=0)
  18. {
  19.     ogon=akt;
  20.     akt=new SLista;
  21.     akt->dane=liczba;
  22.     akt->next=NULL;
  23.  
  24.     if(ogon==NULL)
  25.     {
  26.         glowa=akt;
  27.     }
  28.     else
  29.     {
  30.         ogon->next=akt;
  31.     }
  32.     cin>>liczba;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement