Advertisement
delvinkrasniqi

Untitled

Nov 2nd, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct nyje
  5. {
  6. int data;
  7. nyje *next;
  8.  
  9. };
  10. void Printo(nyje *first)
  11. {
  12. nyje *n = first;
  13.  
  14. while (n!=NULL)
  15.  
  16. {
  17. cout << "Adresa = " << n << endl;
  18. cout << "Data = " << n->data << endl;
  19. cout << "Pointeri = " << n->next<<endl;
  20. n = n->next;
  21.  
  22. }
  23. }
  24.  
  25. int main()
  26. {
  27. nyje *n , *first=NULL , *last=NULL;
  28. int vlera_nyjes , numri_nyjes,i;
  29.  
  30. cout<<"Numri Nyjeveve : ";
  31. cin>>numri_nyjes;
  32.  
  33. for (i=1;i<=numri_nyjes;i++)
  34. {
  35. n=new nyje;
  36. cout<<"Vlera ne nyjen e"<<i;
  37. cin>>vlera_nyjes;
  38. n->data=vlera_nyjes;
  39. n->next=NULL;
  40. if (first==NULL)
  41. {
  42. first =n;
  43.  
  44. }
  45. else
  46. {
  47. last->next=n;
  48. }
  49. last=n;
  50.  
  51. }
  52.  
  53. Printo(first);
  54.  
  55.  
  56. cin.get();
  57. cin.get();
  58. return 0;
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement