Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.74 KB | None | 0 0
  1. program PascalschesDreieck;
  2.  
  3. type
  4.   tRefListe = ^tListe;
  5.  
  6.   tListe = record
  7.     wert : Integer;
  8.     next : tRefListe;
  9.   end;
  10.  
  11. function neueListe(anzahl, initialerWert : Integer) : tRefListe;
  12. var
  13.   i : Integer;
  14.   tail : tRefListe;
  15. begin
  16.   New(tail);
  17.   neueListe := tail;
  18.   tail^.wert := initialerWert;
  19.  
  20.   for i:=2 to anzahl do
  21.   begin
  22.     New(tail^.next);
  23.     tail := tail^.next;
  24.     tail^.wert := initialerWert;
  25.   end;
  26.   tail^.next := nil;
  27. end;
  28.  
  29. var
  30.   testListe : tRefListe;
  31.   aktuellerKnoten : tRefListe;
  32. begin
  33.   testListe := neueListe(3, 24);
  34.  
  35.   aktuellerKnoten := testListe;
  36.   while aktuellerKnoten <> nil do
  37.   begin
  38.     Write(aktuellerKnoten^.wert, ' ');
  39.     aktuellerKnoten := aktuellerKnoten^.next;
  40.   end;
  41. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement