This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Sabtu, 12 Januari 2013

pointer

uses crt;
var p : ^integer;
    nilai : integer ;
    begin
    clrscr;
    nilai:=2013;
    p:=@nilai;
    writeln(p^);
    p^:=1717;
    writeln(nilai);
    readln;
    end.



Pembahasan:

Pada contoh program deklarasi ini, pertama-tama dideklarasikan

variabel p sebagai pointer yang bertipe integer. Dibuat sebuah variabel lagi

yang diberi nama nilai dan bertipe integer.

Variabel nilai diisi dengan nilai 2013. Kemudian variabel p

menunjuk alamat dari variabel nilai dengan operator @, sehingga variabel p

berisi nilai 2013, dan ditampilkan outputnya di layar. Kemudian variabel p

diberi nilai 1717, dan secara otomatis variabel nilai juga bernilai 1717 karena

sudah ditunjuk oleh variabel p. Kemudian isi dari variabel p yang baru dan

variabel nilai ditampilkan di layar.


out put 
2013
1717

Minggu, 06 Januari 2013

game pascal

PROGRAM SULAPANGKA;
USES CRT;
VAR I, J, K, L: INTEGER;
YT: CHAR;
NILAI:INTEGER;
FUNCTION CSTR(I: INTEGER): STRING;
VAR
S: STRING[11];
BEGIN
STR(I, S);
CSTR := S;
END;
PROCEDURE TULIS(POSISI:INTEGER; TEKS:STRING);
VAR A, B, C: INTEGER;
BEGIN
A := POSISI;
B := POSISI MOD 10;
C := 1;
IF B = 0 THEN
BEGIN B := 10;C := 0; END;
GOTOXY(B * 8 - 5,
(A DIV 10 + C) * 3 + 1);
WRITE(TEKS);
END;
PROCEDURE BIKIN_KOTAK(KOLOM, BARIS: INTEGER);
BEGIN
CLRSCR;
FOR I:= 1 TO KOLOM DO
BEGIN
FOR J := 1 TO BARIS DO
BEGIN
GOTOXY (J * 8 - 7, (I * 3));
WRITE('____');
GOTOXY (J * 8 - 7, (I * 3 + 1));
WRITE('|        |');
GOTOXY (J * 8 - 7, (I * 3 + 2));
WRITE('____');
END;
END;
END;
PROCEDURE WIZARD7;
BEGIN
CLRSCR;
WRITELN('ANGKA YANG ANDA PILIH = ', NILAI);
WRITELN;
WRITE('INGIN MENGULANG (Y/ESC.)? ');READKEY;
YT := READKEY;
END;
PROCEDURE WIZARD6;
BEGIN
BIKIN_KOTAK(2, 10);
FOR I := 1 TO 19 DO
TULIS(I, CSTR(I + 31));
GOTOXY (5, 15);
WRITE('APAKAH ANGKA YANG ANDA PILIH',
' ADA PADA DERETAN ANGKA DI ATAS (Y/T) ');
REPEAT
YT := READKEY;
UNTIL YT IN ['y', 'Y', 't', 'T', #27];
IF UPCASE(YT) = 'Y' THEN
NILAI := NILAI + 32;
WIZARD7;
{===============================}
END;
PROCEDURE WIZARD5;
BEGIN
BIKIN_KOTAK(2, 10);
FOR I := 1 TO 16 DO
TULIS(I, CSTR(I + 15));
FOR J := 17 TO 19 DO
TULIS (J, CSTR(J + 31));
GOTOXY (5, 15);
WRITE('APAKAH ANGKA YANG ANDA PILIH',
' ADA PADA DERETAN ANGKA DI ATAS (Y/T) ');
REPEAT
YT := READKEY;
UNTIL YT IN ['y', 'Y', 't', 'T', #27];
{===============================}
IF UPCASE(YT) = 'Y' THEN
NILAI := NILAI + 16;
WIZARD6;
END;
PROCEDURE WIZARD4;
BEGIN
BIKIN_KOTAK(3, 10);
FOR J := 0 TO 2 DO
FOR I := 1 TO 8 DO
TULIS(J * 8 + I, CSTR(J * 16 + I + 7));
GOTOXY (5, 15);
WRITE('APAKAH ANGKA YANG ANDA PILIH',
' ADA PADA DERETAN ANGKA DI ATAS (Y/T) ');
REPEAT
YT := READKEY;
UNTIL YT IN ['y', 'Y', 't', 'T', #27];
IF UPCASE(YT) = 'Y' THEN
NILAI := NILAI + 8;
WIZARD5;
 {===============================}
END;
PROCEDURE WIZARD3;
BEGIN
BIKIN_KOTAK(3, 10);
FOR J := 0 TO 5 DO
FOR I := 1 TO 4 DO
TULIS(J * 4 + I, CSTR(J * 8 + I + 3));
GOTOXY (5, 15);
WRITE('APAKAH ANGKA YANG ANDA PILIH',
' ADA PADA DERETAN ANGKA DI ATAS (Y/T) ');
REPEAT
YT := READKEY;
UNTIL YT IN ['y', 'Y', 't', 'T'];
IF UPCASE(YT) = 'Y' THEN
NILAI := NILAI + 4;
WIZARD4;
{===============================}
END;
PROCEDURE WIZARD2;
BEGIN
BIKIN_KOTAK(3, 10);
J:=0;
FOR J := 0 TO 12 DO
FOR I := 1 TO 2 DO
TULIS(J * 2 + I, CSTR(J * 4 + I + 1));
GOTOXY (5, 15);
WRITE('APAKAH ANGKA YANG ANDA PILIH',
' ADA PADA DERETAN ANGKA DI ATAS (Y/T) ');
REPEAT
YT := READKEY;
UNTIL YT IN ['y', 'Y', 't', 'T', #27];
IF UPCASE(YT) = 'Y' THEN
NILAI := NILAI + 2;
WIZARD3;
{===============================}
END;
PROCEDURE WIZARD1;
BEGIN
BIKIN_KOTAK(3, 10);
L:= 1;
REPEAT
TULIS ((L + 1) DIV 2,CSTR(L));
L:= L + 2;
UNTIL L > 50;
GOTOXY (5, 15);
WRITE('APAKAH ANGKA YANG ANDA PILIH',
' ADA PADA DERETAN ANGKA DI ATAS (Y/T) ');
REPEAT
YT := READKEY;
UNTIL YT IN ['y', 'Y', 't', 'T', #27];
IF UPCASE(YT) = 'Y' THEN
NILAI := 1;
WIZARD2;
{===============================}
END;
PROCEDURE TULIS_NOMOR;
BEGIN
BIKIN_KOTAK(5, 10);
FOR K:= 1 TO 50 DO
TULIS(K, CSTR(K));
GOTOXY(1, 20);
WRITE ('PILIH SEBUAH ANGKA, ',
'TEKAN: Y, KALO MAU TERUS! ');
WRITE ('TEKAN ESC UNTUK KELUAR ');
REPEAT
YT := READKEY;
IF UPCASE(YT) = 'Y' THEN
BEGIN
NILAI := 0;
WIZARD1;
END;
UNTIL YT IN ['y', 'Y', 't', 'T', #27];
{===============================}
END;
(* Program Utama *)
BEGIN
CLRSCR;
TEXTATTR := $1F;
REPEAT
TULIS_NOMOR;
UNTIL YT = #27;
END.