Berikut ini merupakan satu contoh list program pada Turbo Pascal 0.7.
Dala program ini terdapat perpaduan antara program pilihan, biodata, dan program matematika.
Beikut listingnya :
Untuk download program yang sudah di confile klik di sini
Dala program ini terdapat perpaduan antara program pilihan, biodata, dan program matematika.
Beikut listingnya :
{begin}
program pilihan;
uses crt;
var
t : text;
p : string;
nama,alamat,cat : string; umur : integer; {var biodata}
x, y : integer; hasil : real ; op : string; {var matematika}
{menu}
begin
clrscr;
repeat
textcolor (7);
clrscr;
writeln ('Silahkan masukkan pilihan anda..');
writeln ('1. Program biodata ');
writeln ('2. Program Matematika ');
writeln ('3. Tentang Penulis');
writeLn ('4. Keluar. ');
write ('Masukkan angkanya saja : '); readln (p);
{BIODATA}
if (p) = '1' then
begin
textcolor (11);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Silahkan masukkan nama anda : '); readln (nama);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Oke, ',nama,', silahkan masukkan umur anda : '); readln (umur);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Silahkan masukkan alamat anda : '); readln (alamat);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Motto anda : '); readln (cat);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
write;
writeln ('Data yang telah anda input adalah:');
writeln ('Nama : ',nama,'');
writeln ('Umur : ',umur,' tahun');
writeln ('Alamat : ',alamat,'');
writeln ('Motto : ',cat,'');
assign (t,'BIODATA.TXT');
rewrite (T);
writeln (t,'Data yang telah anda tulis adalah:');
writeln (t,'Nama : ',nama,'');
writeln (t,'Umur : ',umur,' tahun');
writeln (t,'Alamat : ',alamat,'');
writeln (t,'Motto : ',cat,'');
close (T);
readkey;
end
{MATEMATIKA}
else if (p) = '2' then
begin
textcolor (9);
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
write ('Silahkan masukkan angka pertama : '); readln (x);
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
writeln (' : ',x,'');
writeln;
writeln ('Masukkan operator yang ingin digunakan : (+, -, x, :)'); readln (op);
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
writeln (' : ',x,' ',op,'');
writeln;
write ('Masukkan angka ke dua : '); readln (y);
if (op='+') then
begin
hasil := x+y ;
end;
if (op='-') then
begin
hasil := x-y;
end;
if (op='x') then
begin
hasil := x*y;
end;
if (op='/') then
begin
hasil := x/y;
end;
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
writeln (' : ',x,' ',op,' ',y,' = ',hasil:5:2,'');
writeln;
writeln ('jadi, hasil dari operasi : ',x,' ',op,' ',y,' = ',hasil:5:2,'');
writeln;
readkey;
end
{Tentang}
else if (p) = '3' then
begin
clrscr;
writeln ('Penulis : Nama : Uccing Gayong ');
writeln (' : Email : uccingayong93@yahoo.co.id');
readkey;
end
{Keluar}
else if (P) = '4' then
begin
clrscr;
writeln ('GOOD BYE... ',nama,'...');
readkey;
end
{keselahan}
else if (p) = '' then
begin
clrscr;
writeln ('Perintah belum terisi !!!');
readkey;
end
else
begin
clrscr;
writeln ('Maaf, Mohon masukkan perintahnya dengan benar.');
readkey;
end
until (p) = '4';
writeln ('');
end.
uses crt;
var
t : text;
p : string;
nama,alamat,cat : string; umur : integer; {var biodata}
x, y : integer; hasil : real ; op : string; {var matematika}
{menu}
begin
clrscr;
repeat
textcolor (7);
clrscr;
writeln ('Silahkan masukkan pilihan anda..');
writeln ('1. Program biodata ');
writeln ('2. Program Matematika ');
writeln ('3. Tentang Penulis');
writeLn ('4. Keluar. ');
write ('Masukkan angkanya saja : '); readln (p);
{BIODATA}
if (p) = '1' then
begin
textcolor (11);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Silahkan masukkan nama anda : '); readln (nama);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Oke, ',nama,', silahkan masukkan umur anda : '); readln (umur);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Silahkan masukkan alamat anda : '); readln (alamat);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
writeln;
write ('Motto anda : '); readln (cat);
clrscr;
writeln (' ---=== PROGRAM BIODATA ===---');
write;
writeln ('Data yang telah anda input adalah:');
writeln ('Nama : ',nama,'');
writeln ('Umur : ',umur,' tahun');
writeln ('Alamat : ',alamat,'');
writeln ('Motto : ',cat,'');
assign (t,'BIODATA.TXT');
rewrite (T);
writeln (t,'Data yang telah anda tulis adalah:');
writeln (t,'Nama : ',nama,'');
writeln (t,'Umur : ',umur,' tahun');
writeln (t,'Alamat : ',alamat,'');
writeln (t,'Motto : ',cat,'');
close (T);
readkey;
end
{MATEMATIKA}
else if (p) = '2' then
begin
textcolor (9);
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
write ('Silahkan masukkan angka pertama : '); readln (x);
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
writeln (' : ',x,'');
writeln;
writeln ('Masukkan operator yang ingin digunakan : (+, -, x, :)'); readln (op);
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
writeln (' : ',x,' ',op,'');
writeln;
write ('Masukkan angka ke dua : '); readln (y);
if (op='+') then
begin
hasil := x+y ;
end;
if (op='-') then
begin
hasil := x-y;
end;
if (op='x') then
begin
hasil := x*y;
end;
if (op='/') then
begin
hasil := x/y;
end;
clrscr;
writeln (' ---=== PROGRAM MATEMATIKA ===---');
writeln;
writeln (' : ',x,' ',op,' ',y,' = ',hasil:5:2,'');
writeln;
writeln ('jadi, hasil dari operasi : ',x,' ',op,' ',y,' = ',hasil:5:2,'');
writeln;
readkey;
end
{Tentang}
else if (p) = '3' then
begin
clrscr;
writeln ('Penulis : Nama : Uccing Gayong ');
writeln (' : Email : uccingayong93@yahoo.co.id');
readkey;
end
{Keluar}
else if (P) = '4' then
begin
clrscr;
writeln ('GOOD BYE... ',nama,'...');
readkey;
end
{keselahan}
else if (p) = '' then
begin
clrscr;
writeln ('Perintah belum terisi !!!');
readkey;
end
else
begin
clrscr;
writeln ('Maaf, Mohon masukkan perintahnya dengan benar.');
readkey;
end
until (p) = '4';
writeln ('');
end.
{end}
Untuk download program yang sudah di confile klik di sini