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.

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