program pointer; uses crt; type ptr= ^integer; var p: integer; x : integer; procedure tambah (a,b:integer; c:ptr); begin c^:= a+b; end; begin tambah(10,5, @p); writeln(p); readln; end.
Berikut Hasil Outputnya :
program pointer; uses crt; type ptr= ^integer; var p: integer; x : integer; procedure tambah (a,b:integer; c:ptr); begin c^:= a+b; end; begin tambah(10,5, @p); writeln(p); readln; end.
program queue; uses crt; type PPNode = ^Pnode; PNode = ^Tnode; Tnode = record data : integer; next : PNode; end; procedure tambah(d,b:PPNode; nilai : integer); var temp: Pnode; Begin new(temp); temp^.data := nilai; temp^.next := nil; if (d^ = nil) then begin d^:=temp; b^:=temp; end else begin b^^.next:=temp; b^:=temp; end; end; procedure hapus(d,b:PPNode); var temp : PNode; begin if (d^ = nil) then begin writeln('Tidak terdapat record di dalam queue'); end else begin temp := d^; d^ := temp^.next; dispose(temp); if (d^ = nil)then begin b^:= nil; end; end; end; procedure tampilkan (q: Pnode); var nilai: integer; begin while (q<> nil) do begin nilai:= q^.data; writeln(nilai); q := q^.next; end; end; var depan, belakang: Pnode; begin clrscr; depan := nil; belakang := nil; tambah (@depan, @belakang, 100); tambah (@depan, @belakang, 200); tambah (@depan, @belakang, 300); tambah (@depan, @belakang, 400); writeln ('Nilai di dalam queue : '); tampilkan(depan); writeln; hapus (@depan, @belakang); writeln('setelah record terdepan dihapus : '); tampilkan(depan); readln; end.berikut outputnya :
Program metode_euler; Uses wincrt; Var t0,y0,h,x,m,hasil : real; n : integer; function dif_f(y,t : real):real; begin dif_f := (y-t)/(y+t); end; procedure euler(y0,t0,h,x : real; n : integer; var hasil : real); var i : integer; y,t : real; begin y := y0; t := t0 ; writeln(0,t:15:6,y:15:6); for i := 1 to n do begin y := y+h*dif_f(y,t); t := t+h; writeln(i,t:15:6,y:15:6); end; hasil := y end; begin write('Perhitungan MNA da suatu PDB dengan metode Euler'); write('Masukkan nilai t awal : ');readln(t0); write('Masukkan nilai y awal : ');readln(y0); write('Masukkan nilai t yang akan dicari y(t) nya : ');readln(x); write('Masukkan ukuran langkah : ');readln(h); m := (x-t0)/h; while frac(m) <> 0 do begin writeln('Ukuran langkah tidak sesuai'); write('Masukkan ukuran langkah : ');readln(h); m := (x-t0)/h; end; n := round(m); writeln('====================================='); writeln(' i t y(t) '); writeln('-------------------------------------'); euler(y0,t0,h,x,n,hasil); writeln('-------------------------------------'); writeln('Nilai y(t) nya adalah : ',hasil:5:6); end.Sekian dari saya terima kasih telah berkunjung.