makasih sudah mengunjungi blok kami, kali ini gw berbagai ilmu tentang pemograman pascal, disini gw menampilkan entrian untuk codingan array 2 dimensi
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
hari =
(senin,selasa,rabu,kamis,jumat,sabtu,minggu) ;
Const
garis =
'-----------------------------------------------------------------------------------------';
var
baris :array[hari,1..6] of string[15] ;
hari1 : hari ;
jam : integer ;
begin
baris[senin,1] := 'matematika' ;
baris[senin,2] := 'matematika' ;
baris[senin,3] := 'bahasa indo' ;
baris[senin,4] := 'bahasa indo' ;
baris[senin,5] := 'olahraga' ;
baris[senin,6] := 'olahraga' ;
baris[selasa,1] := 'matematika' ;
baris[selasa,2] := 'matematika' ;
baris[selasa,3] := 'bahasa indo' ;
baris[selasa,4] := 'bahasa indo' ;
baris[selasa,5] := 'olahraga' ;
baris[selasa,6] := 'olahraga' ;
baris[rabu,1] := 'matematika' ;
baris[rabu,2] := 'matematika' ;
baris[rabu,3] := 'bahasa indo' ;
baris[rabu,4] := 'bahasa indo' ;
baris[rabu,5] := 'olahraga' ;
baris[rabu,6] := 'olahraga' ;
baris[kamis,1] := 'matematika' ;
baris[kamis,2] := 'matematika' ;
baris[kamis,3] := 'bahasa indo' ;
baris[kamis,4] := 'bahasa indo' ;
baris[kamis,5] := 'olahraga' ;
baris[kamis,6] := 'olahraga' ;
baris[jumat,1] := 'matematika' ;
baris[jumat,2] := 'matematika' ;
baris[jumat,3] := 'bahasa indo' ;
baris[jumat,4] := 'bahasa indo' ;
baris[jumat,5] := 'olahraga' ;
baris[jumat,6] := 'olahraga' ;
baris[sabtu,1] := 'matematika' ;
baris[sabtu,2] := 'matematika' ;
baris[sabtu,3] := 'bahasa indo' ;
baris[sabtu,4] := 'bahasa indo' ;
baris[sabtu,5] := 'olahraga' ;
baris[sabtu,6] := 'olahraga' ;
writeln(garis);
writeln('no':4,'senin':12,' |','selasa':12,'
|',' rabu':12,' |',' kamis':12,' |','jumat':12,' |','sabtu':12) ;
writeln(garis) ;
for jam := 1 to 6 do
begin
write (jam:4) ;
for hari1 := senin to sabtu do
begin
write(baris[hari1,jam]:12,' |');
end;
writeln ;
end;
readln ;
end.
--------------projec2
-----------------------------------------program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
hari =
(senin,selasa,rabu,kamis,jumat,sabtu,minggu);
kegiatan = (pagi,siang,sore,malam);
aktivitas = array [kegiatan,hari] of string ;
var
a : aktivitas ;
x : kegiatan ;
j : hari ;
z : string ;
begin
a[pagi,senin] := 'mandi';
a[pagi,selasa] := 'mandi';
a[pagi,rabu] := 'mandi';
a[pagi,kamis] := 'mandi';
a[pagi,jumat] := 'mandi';
a[pagi,sabtu] := 'mandi';
a[pagi,minggu] := 'mandi';
a[siang,senin] := 'makan';
a[siang,selasa] := 'sekolah';
a[siang,rabu] := 'bimbingan';
a[siang,kamis] := 'sekolah';
a[siang,jumat] := 'renang';
a[siang,sabtu] := 'maen';
a[siang,minggu] := 'bersepeda';
a[sore,senin] := 'mandi';
a[sore,selasa] := 'belajar';
a[sore,rabu] := 'ngaji';
a[sore,kamis] := 'belajar';
a[sore,jumat] := 'ngaji';
a[sore,sabtu] := 'maen';
a[sore,minggu] := 'ke rumah teman';
a[malam,senin] := 'tidur';
a[malam,selasa] := 'belajar';
a[malam,rabu] := 'nonton tv';
a[malam,kamis] := 'maen game';
a[malam,jumat] := 'internetan';
a[malam,sabtu] := 'bubuk';
a[malam,minggu] := 'belajar';
for
x:= kegiatan(pagi) to kegiatan(sore) do
begin
//
writeln('kegiatan di tiap pagi :',);
writeln('-------------------------------------------');
for j := hari(senin) to hari(minggu) do
begin
writeln(a[x,j]);
end;
end;
readln;
end.---
----------------------
project 3 --------------------------------
program Project5;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
isi :array[1..10,1..10] of integer ;
i,j : integer ;
begin
isi[1,1,8] := 1 ;
isi[1,2] := 2 ;
isi[1,3] := 3 ;
isi[1,4] := 4 ;
isi[1,5] := 5 ;
isi[2,1] := 6 ;
isi[2,2] := 7 ;
isi[2,3] := 8 ;
isi[2,4] := 9 ;
isi[2,5] := 10 ;
isi[3,1] := 11 ;
isi[3,2] := 12 ;
isi[3,3] := 13;
isi[3,4] := 14;
isi[3,5] := 15 ;
isi[4,1] := 16;
isi[4,2] := 17;
isi[4,3] := 18;
isi[4,4] := 19;
isi[4,5] := 20 ;
isi[5,1] := 21;
isi[5,2] := 22;
isi[5,3] := 23;
isi[5,4] := 24;
isi[5,5] := 25 ;
for j := 1 to 5 do
begin
for
i := 1 to 4 do
write (isi[i,j]:5);
writeln(isi[i,j]:5);
end;
readln ;
Yap, disini gw menampilkan 3 project.
Selamat mencoba ya......
Tidak ada komentar:
Posting Komentar