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, 02 Mei 2015

Program FIle Pada Pascal

Contoh Program File Pada Pascal

Program FileTeman;

Uses Crt;
Var
JenisFile    : Text;
Nama         : String;
ALamat       : String;
Telp         : String;
Tanya        : Char;
Pilihan      : shortint;

Begin
Repeat
ClrScr;
Writeln;
writeln(' ____________________________________');
writeln('|        Pilih Salah Satu Menu       |');
writeln('|____________________________________|');
writeln('| 1. Membuat File Data Baru          |');
writeln('| 2. Memasukkan Data Baru            |');
writeln('| 3. Menampilkan Data                |');
writeln('| 4. Keluar                          |');
writeln('|____________________________________|');
writeln('| Masukkan Pilihan :                 |');
writeln('|____________________________________|');
gotoxy(22,10);Readln(Pilihan);
Case  Pilihan Of
1 : Begin
Assign(JenisFile,'Alamat.dat');
ReWrite(JenisFile);
Close(JenisFile);
writeln;
writeln('| File Data Berhasil Dibuat!         |');
writeln('|____________________________________|');
readkey;
End;

2 : Begin
Assign(JenisFile,'Alamat.dat');
Append(JenisFile);
Repeat
ClrScr;
Write(' Nama         : ');Readln(Nama);
Write(' ALamat       : ');Readln(Alamat);
Write(' Telepon      : ');Readln(Telp);
Writeln(JenisFile,Nama);
Writeln(JenisFile,Alamat);
Writeln(JenisFile,Telp);
Writeln;
Write('Apakah mau memasukan data lain (Y/T): ');
Tanya := ReadKey;
Until UpCase(Tanya) = 'T';
Close(JenisFile);
Writeln('Data telah dimasukan !');
End;

3 : Begin
Assign(JenisFile,'Alamat.dat');
Reset(JenisFile);
Repeat
Readln(JenisFile,Nama);
Readln(JenisFile,Alamat);
Readln(JenisFile,Telp);
ClrScr;
Writeln(' Nama         : ',Nama);
Writeln(' ALamat       : ',ALamat);
Writeln(' Telepon      : ',Telp);
Writeln;

If Nama = '' Then
Tanya := 'T'
Else
Begin
Write('Apakah melihat data berikut (Y/T) : ');
Tanya := ReadKey;
End;
Until UpCase(Tanya) = 'T';
Close(JenisFile);
End;

Else
End;
Until Pilihan=4;

End.



Minggu, 19 April 2015

Linked List

Contoh Program Linked List

uses crt;
  type pointer=^typedata;
       Typedata = RECORD
       Nilai : INTEGER;
       Berikutnya : POINTER;
  end;
var list :pointer;

procedure mas_dep(var L : pointer; x : Integer);
var baru : pointer;
 begin
  new(baru);
  baru^.Nilai:=x;
  baru^.Berikutnya:= nil;
  if L= nil then L:=baru
  else
  begin
  baru^.berikutnya :=L;
  L:= baru;
  end;
 end;

procedure cetak (L:pointer);
var bantu : pointer;
 begin
  bantu:= L;
  while bantu <> nil do
  begin
  write (bantu^.Nilai:3);
  Bantu:=bantu^.Berikutnya;
   end;
  end;

 var bil, bil2 : integer;
 JB : char;
  begin
  clrscr;
  new(list);
  list:=nil;
  jb:='Y';
  writeln(' ________________________________');
  writeln('|      Program Linked List       |');
  writeln('|          Masuk Depan           |');
  writeln('|________________________________|');
  readkey;
  clrscr;
  while upcase(Jb)='Y' do
  begin
  clrscr;
   writeln(' ________________________________');
   writeln('| Masukkan bilangan :            |');
   writeln('|________________________________|');
   gotoxy(23,2);readln(bil);
   mas_dep(list,bil);
   writeln;
   writeln('| Lagi [Y/T]  :                  |');
   writeln('|________________________________|');
   gotoxy(17,4);readln(Jb);
   end;
   writeln('|________________________________|');
   writeln('|                                |');
   writeln('|________________________________|');
   gotoxy(3,6);cetak(list);
   writeln;
   readln;
   end.









Minggu, 12 April 2015

Program Pointer Tak Bertipe Pada Pascal

Contoh Program Pointer Tak Bertipe Pada Pascal

uses crt;
var
p : Pointer;
q : ^Byte;
r : array [0..100] of Byte;
i : Byte;
n : integer;
begin
clrscr;
write('Masukkan jumlah data : '); readln(n);
writeln;
writeln;
GetMem(p, 20);
q:=p;
for i:=0 to n do
begin
r[i]:=n-i;
q^:= n-i;
inc(q);
end;
q:=p;
for i:=0 to n do
begin
writeln(' ___________________________');
writeln('|             |             |');
writeln('| r[ ', i ,' ] = ', r[i], '  | p^ ke-', i ,' = ', q^, ' |');
writeln('|_____________|_____________|');
inc(q);
end;
readln;
end.


 

Senin, 06 April 2015

Program Mencari Nilai Maksimum dan Minimum pada pascal

Contoh program mencari nilai yang sudah kita inputkan serta mencari nilai maksimum dan nilai minimum

uses crt;

label awal;

const nmin = 1;
      nmax = 100;

type  arrint = array [nmin..nmax] of integer;
var tabint : arrint;
    x,n,i,indeks,max,min,maks : integer;

function seqsearch1(xx : integer): integer;
  var i : integer;
  begin
    i := 1;
    while ((i<n) and (tabint[i] <> xx)) do
      i:=i+1;
      if tabint[i] = xx then
        seqsearch1:=i
        else
        seqsearch1:=0;
  end;

function maksimum (tabint: arrint; n : integer) : integer;
  var i, max : integer;
  begin
   for i:=2 to n do
   if max<tabint[i] then
   max:=tabint[i];
   maksimum:=max;
  end;

function minimum (tabint: arrint; n : integer) : integer;
  var i, min : integer;
  begin
   for i:=1 to n do
   if min>tabint[i] then
   min:=tabint[i];
   minimum:=min;
  end;


begin
  clrscr;
  writeln;
  writeln('      Progaram Pencarian Nilai');
  writeln;
  writeln;
  writeln;
  write('Masukkan Jumlah Data = '); readln(n);
  writeln;
  writeln;
  for i:=1 to n do
    begin
       write('Data[',i,'] = '); readln(tabint[i]);
     end;
     clrscr;
    writeln;
    writeln;
        write ('  Nilai yang dicari : '); readln(x);
    indeks:=seqsearch1(x);
    writeln;
      if indeks <> 0 then
      write ('  Nilai : ',x,' ditemukan pada indeks ke-',indeks)
       else
      write('   Nilai : ',x,' tidak ditemukan !');

 begin
 writeln;
  maks:=maksimum(tabint,n);
  min:=minimum(tabint,n);
  writeln;
  writeln ('* Nilai maksimum : ',maks);
  writeln ('* Nilai minimum  : ',min );
  readln;
  end;
 end.


Senin, 30 Maret 2015

Contoh Proogram Selection Sort Data Mahasiswa pada Pascal

Berikut contoh program pengurutan nilai IPK pada data mahasiswa

uses crt;
type mhs= record
     Nama, NIM: string;
     IPK : real;
end;
var Data : array [1..100] of mhs;
    i, j, n, temp : integer;
    pilih : char;

procedure input;
begin
clrscr;
write('Masukkan jumlah mahasiswa : ');
readln(n);
for i := 1 to n do
begin
  writeln(' ___________________________________');
  writeln('|        Data Mahasiswa Ke-',i,'        |');
  writeln('|-----------------------------------|');
  writeln('| Nama    :                         |');
  writeln('| NIM     :                         |');
  writeln('| IPK     :                         |');
  writeln('|___________________________________|');
  gotoxy(13,5+(7*(i-1)));readln(Data[i].Nama);
  gotoxy(13,6+(7*(i-1)));readln(Data[i].NIM);
  gotoxy(13,7+(7*(i-1)));readln(Data[i].IPK);
  writeln;
 end;
end;

Procedure Table;
Begin
  writeln('|    |                          |           |           |');
  writeln('|____|__________________________|___________|___________|');
end;


procedure Tampil;
begin
clrscr;
 writeln(' _______________________________________________________');
 writeln('|                                                       |');
 writeln('|                 DATA NILAI MAHASISWA                  |');
 writeln('|_______________________________________________________|');
 writeln('|    |                          |           |           |');
 writeln('| No |         Nama             |    NIM    |    IPK    |');
 writeln('|____|__________________________|___________|___________|');
for i:=1 to n do
begin
 gotoxy(1,7+i);Table;
 gotoxy(3,7+i);writeln(i);
 gotoxy(8,7+i);writeln(Data[i].Nama);
 gotoxy(35,7+i);writeln(Data[i].NIM);
 gotoxy(50,7+i);writeln(Data[i].IPK:2:0);
 end;
readkey;
end;

procedure Selection;
var max: integer;
temp: mhs;
begin
 for i:=1 to n-1 do
  begin
   max:=i;
   for j:= i+1 to n do
    if Data[j].IPK< Data[max].IPK then
    max:=j;
    temp:= Data[max];
    Data[max]:= Data[i];
  Data[i]:= temp;
  end;
Tampil;
end;

begin
input;
Selection;
end.

Screenshot


Minggu, 22 Maret 2015

Contoh Program Rekursif pada pascal

uses crt;
function kali(a,b:integer):longint;
begin
if b>1 then
begin
        kali:= kali(a,b-1)+a;
end else
kali:=a;
end;

procedure  Volume;
var a,b,c:integer;
    v:real;
begin clrscr;
      write('Panjang Limas  : '); readln(a);
      write('Lebar Limas    : '); readln(b);
      write('Tinggi Limas   : '); readln(c);
      v:=1/3*kali(a,b)*c;
      writeln('Volume Limas : ',v:2:0); readln;
end;

procedure Luas;
var a,b,c :integer;
        l :real;
begin
clrscr;
      write('Panjang Limas  : '); readln(a);
      write('Lebar Limas    : '); readln(b);
      write('Tinggi Limas   : '); readln(c);
      l:=kali(a,b)+1/2*kali(b,c)*4;
      writeln('Luas Limas   : ',l:2:0);  readln;
end;

var Pilih : char;
begin
repeat
clrscr;
writeln(' 1. Volume Limas Segi Empat');
writeln(' 2. Luas Limas Segi Empat');
writeln(' 3. Keluar');
writeln;
write('Pilih  : ');readln(Pilih);
case Pilih of
'1' : Volume;
'2' : Luas;
'3' : exit;
end;
until Pilih = '3';
end.




Minggu, 15 Maret 2015

Array dan Record dalam Bahasa Pascal

1. Array 
     Array adalah sekumpulan variabel yang memiliki tipe data yang sama dan dinyatakan dengan nama yang sama. Array merupakan konsep yang penting dalam pemrograman.

2. Record

    Record adalah sebuah tipe data yang mengumpulkan beberapa item data di mana masing-masing tipe data dari item data ini berbeda-beda. Masing-masing item data ini bisa disebut dengan field.

Contoh Program Matrik 2 Dimensi dan Record
 Program Biodata_Mahasiswa;
 uses crt;
 Type Rec  = Record
      Nama : String[10];
      NIM  : String[10];
      Umur : Longint;
 end;
 var Data  : array[1..50] of Rec;
     n,i   : integer;
     Pilih : char;

 Procedure Input;
 Begin
  clrscr;
  n:=0;
  repeat
  clrscr;
  inc(n);
  writeln(' __________________________');
  writeln('|      BIODATA MAHASISWA     |');
  writeln('|__________________________|');
  writeln('| Data ke-',n,'                            |');
  writeln('|__________________________|');
  with Data[n] do
  begin
  writeln(' __________________________');
  writeln('| Nama :                                        |');
  writeln('| NIM  :                                         |');
  writeln('| Umur :     Tahun                           |');
  writeln('|__________________________|');
  gotoxy(10,7);readln(Nama);
  gotoxy(10,8);readln(NIM);
  gotoxy(10,9);readln(Umur);
  end;
  writeln;
  write('Input Data Lagi? [Y/N] : ');readln(Pilih);
  Until ((Pilih='n') or (Pilih='N'));
 end;

 Procedure Kolom;
 Begin
 writeln('|                                              |                    |              Tahun |');
 writeln('|_______________________|__________|____________|');
 end;

 Procedure Output;
 Begin
 clrscr;
 writeln(' _______________________________________________');
 writeln('|                             BIODATA MAHASISWA                        |');
 writeln('|_______________________________________________|');
 writeln('|                    Nama                 |      NIM      |          Umur        |');
 writeln('|_______________________|__________|_____________|');
 writeln('|                                               |                   |                          |');
 for i:=1 to n do
  begin
   with Data[i] do
    begin
     gotoxy(1,6+i);Kolom;
     gotoxy(3,6+i);writeln(Nama);
     gotoxy(27,6+i);writeln(NIM);
     gotoxy(38,6+i);writeln(Umur);
    end;
  end;
 readkey;
end;

Begin
repeat
clrscr;
  writeln(' ______________________');
  writeln('|            Menu Utama            |');
  writeln('|  1. Masukkan Data              |');
  writeln('|  2. Lihat Data                      |');
  writeln('|  3. Keluar                           |');
  writeln('|______________________|');
  writeln('|                                            |');
  writeln('| Masukkan Pilihan :              |');
  writeln('|______________________|');
  gotoxy(22,8);readln(Pilih);
  case Pilih of
  '1' : Input;
  '2' : Output;
  '3' : Exit;
end;
Until (Pilih)='3';
end.




Contoh Screenshoot Program pada saat dijalankan




sealkazzsoftware.blogspot.com resepkuekeringku.com