Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program f84405e0;
- type
- tRefListe = ^tListe;
- tListe = record
- wert: integer;
- next: tRefListe
- end;
- function neuerKnoten(wert: Integer): tRefListe;
- begin
- New(neuerKnoten);
- neuerKnoten^.wert := wert;
- neuerKnoten^.next := nil;
- end;
- function neueReihe(A: tRefListe): tRefListe;
- var
- i: Integer;
- knotenA: tRefListe;
- knotenNeu: tRefListe;
- begin
- neueReihe := neuerKnoten(1);
- knotenNeu := neueReihe;
- knotenA := A;
- while knotenA^.next <> nil do
- begin
- knotenNeu^.next := neuerKnoten(knotenA^.wert + knotenA^.next^.wert);
- knotenNeu := knotenNeu^.next;
- knotenA := knotenA^.next;
- end;
- knotenNeu^.next := neuerKnoten(1);
- end;
- var
- reihe: tRefListe;
- knoten: tRefListe;
- i: Integer;
- begin
- reihe := neuerKnoten(1);
- for i := 1 to 5 do
- begin
- reihe := neueReihe(reihe);
- end;
- knoten := reihe;
- repeat
- write(knoten^.wert, ' ');
- knoten := knoten^.next;
- until knoten = nil;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement